小编dol*_*ols的帖子

为什么play-services-location需要android.permission.WRITE_EXTERNAL_STORAGE和android.permission.READ_EXTERNAL_STORAGE权限?

我在AndroidManifest.xml中的所有内容是:

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
Run Code Online (Sandbox Code Playgroud)

将APK上传到开发者控制台后,它会添加两个新权限: 在此输入图像描述

我的build.gradle:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 22
    buildToolsVersion "22.0.1"

    defaultConfig {
        applicationId "net.perspiratron.ifpaprofile"
        minSdkVersion 15
        targetSdkVersion 22
        versionCode 3
        versionName "1.2"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
//    wearApp project(':wear')
    compile 'com.android.support:appcompat-v7:22.2.0'
    compile 'com.google.android.gms:play-services-analytics:7.5.0'
    compile 'com.google.android.gms:play-services-location:7.5.0'
    compile 'com.jjoe64:graphview:4.0.0'
}
Run Code Online (Sandbox Code Playgroud)

我添加的唯一内容是play-services-location.为什么这个库需要它?

android android-permissions google-play-services android-studio

11
推荐指数
1
解决办法
2230
查看次数

如何测试android.intent.action.MY_PACKAGE_REPLACED

我希望能够为MY_PACKAGE_REPLACED测试BroadcastReceiver.

我可以使用adb命令完成此操作吗?

当我从IDE(Android工作室)启动应用程序时,模拟器是否实现了这一点?

android adb android-intent android-service

9
推荐指数
1
解决办法
3560
查看次数

更改 Maven 货物插件部署路径

我想让我的集成测试在http://localhost:8080/messaging 上命中货物的 tomcat,但货物 (cargo-maven2-plugin:1.0.5) 更喜欢将我的消息传递项目部署为 /messaging-0.0.7-SNAPSHOT,如在 tomcat 管理控制台和 target\tomcat6x\webapps 目录中看到。

所以我尝试将这些行添加到货物配置中,认为它会选择默认工件:

 <deployer>
  <deployables>
   <deployable>
     <properties>
     <context>/messaging</context>
    </properties>
   </deployable>
  </deployables>
 </deployer>
Run Code Online (Sandbox Code Playgroud)

但事实并非如此。它甚至没有尝试,因为我在 target\tomcat6x\webapps 目录中没有看到消息或消息 0.0.7-SNAPSHOT。

当我像这样设置它时会发生同样的事情:

<configuration>
  <type>standalone</type>
 <wait>false</wait>
 <properties>
  <cargo.servlet.port>8080</cargo.servlet.port>
  <cargo.logging>high</cargo.logging>
 </properties>
 <deployer>
  <deployables>
   <deployable>
     <groupId>com.company.platform</groupId>
     <artifactId>messaging</artifactId>
     <type>war</type>
     <properties>
     <context>/messaging</context>
    </properties>
   </deployable>
  </deployables>
 </deployer>
</configuration>
Run Code Online (Sandbox Code Playgroud)

这是完整的插件配置:

  <plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<executions>
 <execution>
  <id>start</id>
  <phase>pre-integration-test</phase>
  <goals>
   <goal>start</goal>
  </goals>
 </execution>
 <execution>
  <id>stop</id>
  <phase>post-integration-test</phase>
  <goals>
   <goal>stop</goal>
  </goals>
 </execution>
</executions>
<configuration>
  <type>standalone</type>
 <wait>false</wait>
 <properties>
  <cargo.servlet.port>8080</cargo.servlet.port>
  <cargo.logging>high</cargo.logging>
 </properties>
 <deployer>
  <deployables>
   <deployable>
     <properties>
     <context>/messaging</context>
    </properties> …
Run Code Online (Sandbox Code Playgroud)

cargo maven-cargo maven

5
推荐指数
1
解决办法
4604
查看次数