androidstudioproblems
1 在android studio 下新建android project ,编译没有问题。
创新互联建站服务项目包括蓝田网站建设、蓝田网站制作、蓝田网页制作以及蓝田网络营销策划等。多年来,我们专注于互联网行业,利用自身积累的技术优势、行业经验、深度合作伙伴关系等,向广大中小型企业、政府机构等提供互联网行业的解决方案,蓝田网站推广取得了明显的社会效益与经济效益。目前,我们服务的客户以成都为中心已经辐射到蓝田省份的部分城市,未来相信会继续扩大服务区域并继续获得客户的支持与信任!
而导入已经存在的项目时,一直报错:Connection refused。
这个时候就要考虑是配置哪里跟自己android studio 本地的不一样,果然:
问题出在 build.gradle:
classpath 'com.android.tools.build:gradle:com.android.tools.build:gradle:2.2.3'
这个要跟自己local一致才可以。
2
执行 android studio可以编译项目但是在命令行 ./gradlew 则报错:
Downloading https://services.gradle.org/distributions/gradle-2.14.1-all.zip
Exception in thread "main" java.lang.RuntimeException: java.net.ConnectException: Connection timed out
at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:78)
需要配置project gradle.properties,添加
systemProp.http.proxyHost=proxy id systemProp.http.nonProxyHosts=192.168.*, systemProp.http.proxyPort=3128 systemProp.https.proxyHost=proxy id systemProp.https.nonProxyHosts=192.168.*, systemProp.https.proxyPort=3128
因为download 用的是https, 而直接用studio 编译好像用的是http
3 andorid studio 升级后,直接安装apk使用 multiple slice apks 的方式,即
adb install-multiple -r code/app/build/outputs/apk/app-debug.apk code/app/build/intermediates/split-apk/debug/slices/slice_3.apk code/app/build/intermediates/split-apk/debug/slices/slice_9.apk code/app/build/intermediates/split-apk/debug/slices/slice_2.apk code/app/build/intermediates/split-apk/debug/slices/slice_0.apk code/app/build/intermediates/split-apk/debug/slices/slice_1.apk code/app/build/intermediates/split-apk/debug/slices/slice_4.apk code/app/build/intermediates/split-apk/debug/slices/slice_8.apk code/app/build/intermediates/split-apk/debug/slices/slice_5.apk code/app/build/intermediates/split-apk/debug/slices/slice_6.apk code/app/build/intermediates/split-apk/debug/slices/slice_7.apk Split APKs installed
但是编译出来的
app-debug.apk
直接安装就会报错,所以想使用adb install方式安装的话需要
disable instant run.
具体 File->settings->searchbox(type instant run)-> select disable option.
4 apk安装不上,报错: INSTALL_FAILED_TEST_ONLY: installPackageLI.
原因: android studio ,gradle plugin, gradle tool是beta版本,版本配置不对导致的
in app/gradle/wrapper/gradle-wrapper.properties:
distributionUrl=https\://services.gradle.org/distributions/gradle-4.0-rc-1-all.zip
app/build.gradle
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0-alpha4'
}
都需要修改,再编译即可。
5 在命令行编译app ,
./gradlew clean assemble:
得到错误:
FAILURE: Build failed with an exception. * What went wrong: A problem occurred configuring root project 'FacebookTestPlan'. > Could not resolve all files for configuration ':classpath'. > 3.0.0-alpha4. Searched in the following locations: https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.0-alpha4/gradle-3.0.0-alpha4.pom https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.0-alpha4/gradle-3.0.0-alpha4.jar Required by: project :
原因:看起来是下载组件不成功。
在project/build.gradle中
a)buildscript和allprojects都需要添加
maven {
url 'https://maven.google.com'
// Alternative URL is 'https://dl.google.com/dl/android/maven2/'
}
两个都需要根据数据下载相应插件,
b)allprojects并不包括buildscript. buildscript只是给build的组件用的。
The buildscriptblock is where you configure the repositories and dependencies for Gradle itself--meaning, you should not include dependencies
for your modules here.
The allprojectsblock is where you configure the repositories and
* dependencies used by all modules in your project, such as third-party plugins
* or libraries. Dependencies that are not required by all the modules in the
* project should be configured in module-level build.gradle files.
c) 写在app/build.gradle里面和写在allprojects是一样的。
related URL :https://developer.android.com/studio/build/index.html
6
网页标题:androidstudioproblems
新闻来源:http://azwzsj.com/article/jieppo.html