AS(Android studio)常见问题
来源:互联网 发布:淘宝网晚礼服 编辑:程序博客网 时间:2024/05/17 00:08
1.JUnit 找不到问题
JUnit是一个Java语言的单元测试框架,在as gradle编译的时候需要引入单元测试的东西,因此需要引用这个jar包。
以前一直用Eclipse开发Android,最近准备用用Android Studio好不容易配置完了,新建了个工程竟然是有错误
Error:A problem occurred configuring project ':app'.
> Could not download junit.jar (junit:junit:4.12)
> Could not get resource 'https://jcenter.bintray.com/junit/junit/4.12/junit-4.12.jar'.
> Could not GET 'https://jcenter.bintray.com/junit/junit/4.12/junit-4.12.jar'.
> peer not authenticated
翻墙下载了junit-4.12.jar,才创建成功。然后我找到了junit-4.12.jar的文件路径,大家再遇到这个问题,也不想麻烦去翻墙,可以直接下载一个junit-4.12.jar,放到自己的Android Studio的相应目录中,然后重启android studio就可以了。
1.找到自己android studio 的安装目录,下面是我自己的android studio安装目录:D:\Android\Android Studio\
2.把junit-4.12.jar放到D:\Android\Android Studio\gradle\gradle-2.4\lib\plugins\目录下就ok了。
或者将中间代码注释掉
dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) //testCompile 'junit:junit:4.12' compile 'com.android.support:appcompat-v7:23.3.0'}
2.解决Android studio Instance Run 错误(Tools | Android | Enable ADB integration' to be enabled)
研究了一下Instant Run是Android Studio 2.0新加入的功能,可以快速部署代码的更改到模拟器/手机上,不用像之前一样等半天。
可以在设置里把Instant Run打开或者关掉,设置地方如下图:
这个开关要是打开,那么在 Tools - Android - Enable ADB Integration 也需要打开
3.解决 Android studio 导入jar 问题
在 app/build.gradle文件中如果引入compile fileTree(dir: 'libs', include: ['*.jar']) 那么jar文件是直接可以放置在libs文件下。在 AS 中引入jar有几种方式:1.引入Android studio安装目录中的lib文件夹中的库,常见的有annotation,junit等。2.就是gradle下载的,如:compile 'com.google.android.gms:play-services:9.8.0' 3.sdk中下载的jar 4.工程目录下libs文件夹中的jar.
4.Your project path contains non-ASCII characters. This will most likely cause the build to fail on Windows. Please move your project to a different directory.
See http://b.android.com/95744 for details. This warning can be disabled by using the command line flag -Dcom.android.build.gradle.overridePathCheck=true,
or adding the line com.android.build.gradle.overridePathCheck=true' to gradle.properties file in the project directory.
其实很好解决啦,就是你的工程项目路径或者项目名称包含了中文,修改相关的名称就好了!
5. 运行Android studio工程Error:Execution failed for task ':app:dexDebug'. com.android.ide.common.process.ProcessException:
org.gradle.process.internal.ExecException: Process 'command '/usr/lib/jvm/java-7-oracle/bin/java''
finished with non-zero exit value 2
这个问题可能是jar包的重复导入也有可能是方法数溢出。 加上 multiDexEnabled true
- defaultConfig {
- applicationId ""
- minSdkVersion 14
- targetSdkVersion 21
- versionCode 19
- versionName "1.2.7"
- // dex突破65535的限制
- multiDexEnabled true
- }
- AS(Android studio)常见问题
- Android Studio 常见问题
- Android Studio常见问题
- Android Studio 初装常见问题
- Android Studio 常见问题汇总
- Android Studio 常见问题
- Android Studio常见问题
- Android Studio 常见问题汇总
- Android Studio常见问题
- android studio 常见问题
- Android Studio 常见问题
- Android Studio 常见问题
- Android Studio常见问题整理
- android studio常见问题收集
- Android Studio 常见问题
- Android Studio 常见问题集锦
- android studio常见问题
- Android studio常见问题
- SAP生产订单 状态
- (12)标准库类型string
- ios的手势操作之UIGestureRecognizer浅析
- iOS 应用之间的跳转
- 使用Python库ElementTree解析Hadoop的xml配置文件
- AS(Android studio)常见问题
- UIView上添加了一个按钮和一个单击手势的事件相应,互相不影响的处理方法。。
- struts2配置文件加载顺序
- gensim快速使用简介
- 传统软件开发中的详细设计
- IIS7.5中对所有请求响应的JSON数据进行GZIP编码
- UIButton中setTitleEdgeInsets和setImageEdgeInsets的使用
- pig语法学习 FOREACH GENERATE group AS
- GitHub提交新建文件