Android Studio升级至3.0所遇到的问题

Error:android-apt plugin is incompatible withthe Android Gradle plugin.  

Please use 'annotationProcessor'configuration instead.


错误:Android - apt插件与AndroidGradle插件不兼容。请使用“注解处理器”配置。

 

1.apt不支持了

apply plugin:'android-apt' 去掉

将apt改成annotationProcessor 

 

例如:

apt'com.google.dagger:dagger-compiler:2.0.2'

compile'com.google.dagger:dagger:2.0.2'

 改成

annotationProcessor 'com.google.dagger:dagger-compiler:2.0.2'

compile 'com.google.dagger:dagger:2.0.2'

 

2.支持java1.8

apply plugin: 'me.tatarka.retrolambda'干掉.原生支持lambda

 

3.报错一

Error:Execution failed for task':app:compileDebugNdk'.

> Error: Flag android.useDeprecatedNdk isno longer supported and will be removed in the next version of Android Studio. Please switch to a supported build system.

  Consider using CMake or ndk-buildintegration. For more information, go to:

android.useDeprecatedNdk=true这句话注释掉,不支持了

用cmakelist打包.so文件

 

使用教程:

NDK开发从入门到放弃(七:Android Studio2.2 CMAKE 高效NDK开发

http://blog.csdn.net/cuiyufeng2/article/details/64125594

 

若遇到如下错误

More than one file was found with OSindependent path 'lib/armeabi/libserial_port.so'

 jni.srcDirs = ['src/main/jni','src/main/jni/']改成

jniLibs.srcDirs = [] clean一下重新编译就好了;

如果还不行去掉这句话 jniLibs.srcDirs = ['libs']

 

4.报错二

Error:(101, 5) error: style attribute'@android:attr/windowExitAnimation' not found.

gradle.properties里面加入android.enableAapt2=false

 

 

更换JDK版本:

File->Project Structure->Modules中的Properties选项卡,把SourceCompatibility TargetCompatibility都改成 1.8

现在默认是使用Java 1.8编译了。 

 

以上内容根据自己遇到的情况,查找技术博客觉得好的地方就直接应用了,内容仅供学习参考。

 

 

 
 
 
 
 
 
 
 
 
 
 
 
 
 

猜你喜欢

转载自blog.csdn.net/diminess/article/details/78419215