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 就好了,或者直接注释掉。代码如下:
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里面
- dependencies {
- compile fileTree(dir: 'libs', include: ['*.jar'])
- compile 'com.android.support:appcompat-v7:22.2.1'
- compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha1'
- testCompile 'junit:junit:4.12'
- androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2'
- androidTestCompile 'com.android.support.test:runner:0.5'
- androidTestCompile 'com.android.support:support-annotations:23.1.1'
- }
一眼瞅过去肯定以为只要把最后一项
- com.android.support:support-annotations:23.1.1
- dependencies {
- compile fileTree(dir: 'libs', include: ['*.jar'])
- compile 'com.android.support:appcompat-v7:22.2.1'
- compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha1'
- testCompile 'junit:junit:4.12'
- androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2'
- androidTestCompile 'com.android.support.test:runner:0.5'
- androidTestCompile 'com.android.support:support-annotations:22.2.1'
- configurations.all {
- resolutionStrategy.force 'com.android.support:support-annotations:22.1.0'
- }
- }