Android Studio2.2版本升级后遇到的问题汇总

263 篇文章 2 订阅
164 篇文章 0 订阅

1、 java.lang.UnsupportedClassVersionError: com/android/build/gradle/AppPlugin : Unsupported major.minor version 52.0

翻译过来,很显然是class版本不支持。经查询,Android Studio2.2必须使用JDK8及以上版本,而且是强制的。

所以呢,赶紧下了个JDK8最新版的。安装完毕,把JAVA_HOME指向了JDK8,实测JDK7和8是可以共存的。

那么,重启Android Studio后问题解决,Build Successful !

2、resources-yingyongbao-release-stripped.ap_’ specified for property ‘resourceFile’ does not exist.

详细信息如下:

Error:A problem was found with the configuration of task ‘:app:packageYingyongbaoRelease’.
> File ‘C:\Android\WorkSpace\CDSTM\app\build\intermediates\res\resources-yingyongbao-release-stripped.ap_’ specified for property ‘resourceFile’ does not exist.

这是在打包的时候遇到的,看意思是说资源文件不存在。

查了下资料,有人说,禁止Instant Run就可以了。

步骤:File—>Settings,打开Settings界面,搜索到Instant Run,去掉第一项的勾选,即去掉“Enable Instant Run to hot swap code/resources on deploy (default enabled)”。

然后查到资料说是AS2.2编译打包有所不同,会自动剔除无用代码和资源。那么,原因就明确了。

在app的build.gradle文件中设置 shrinkResources false 就好了,或者直接注释掉。代码如下:

buildTypes {
    release {
        minifyEnabled false //混淆打包
        //shrinkResources true // 是否去除无效的资源文件,混淆打包的时候已经包含此设置
        signingConfig signingConfigs.release //签名
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
    debug {
        minifyEnabled false
        //shrinkResources false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}

3、can't use subversion command line client: svn.

今天把本地的一个SVN导入到Android Studio中,于是就报这个错误。查找了一些答案,发现是因为安装SVN的时候没有安装命令行工具,默认是没有选中的。

解决办法是重新安装一下svn,勾选“command line client tools”(这个默认是不勾选的)。

安装成功以后,重启Android Studio就行。

4.Conflict with dependency 'com.Android.support:support-annotations'. Resolved versions for app (22.2.1) and test app (23.1.1) differ. See http://g.co/androidstudio/app-test-app-conflict for details.

测试版本用的库和最终用的库版本号不一致

首先先定位问题出现在哪里,build.gradle里面的dependencies里面

  1. dependencies {  
  2.     compile fileTree(dir: 'libs', include: ['*.jar'])  
  3.     compile 'com.android.support:appcompat-v7:22.2.1'  
  4.     compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha1'  
  5.     testCompile 'junit:junit:4.12'  
  6.     androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2'  
  7.     androidTestCompile 'com.android.support.test:runner:0.5'  
  8.     androidTestCompile 'com.android.support:support-annotations:23.1.1'  
  9. }  


一眼瞅过去肯定以为只要把最后一项

[java] view plain copy
 print?在CODE上查看代码片派生到我的代码片
  1. com.android.support:support-annotations:23.1.1 
后面修改为22.2.1就行了是吧?

[java]  view plain  copy
 print ? 在CODE上查看代码片 派生到我的代码片
  1. dependencies {  
  2.     compile fileTree(dir: 'libs', include: ['*.jar'])  
  3.     compile 'com.android.support:appcompat-v7:22.2.1'  
  4.     compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha1'  
  5.     testCompile 'junit:junit:4.12'  
  6.     androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2'  
  7.     androidTestCompile 'com.android.support.test:runner:0.5'  
  8.     androidTestCompile 'com.android.support:support-annotations:22.2.1'  
  9.     configurations.all {  
  10.         resolutionStrategy.force 'com.android.support:support-annotations:22.1.0'  
  11.     }  
  12. }  
终于build successful


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值