我试图使用图书馆会议室持久性,SDK min 16。 在gradle中添加空间持久性后,我得到以下错误: 如果我采取最后2行依赖(从lib室)编译正常。 救命啊!
error: cannot access ActivityCompatApi23
public class MainActivity extends AppCompatActivity
^
class file for android.support.v4.app.ActivityCompatApi23 not found
An exception has occurred in the compiler (1.8.0_05). Please file a bug at the Java Developer Connection (http://java.sun.com/webapps/bugreport) after checking the Bug Parade for duplicates. Include your program and the following diagnostic in your report. Thank you.
java.lang.NullPointerException
at com.sun.tools.javac.comp.Check$Validator.visitSelect(Check.java:1301)
at com.sun.tools.javac.tree.JCTree$JCFieldAccess.accept(JCTree.java:1891)
at com.sun.tools.javac.comp.Check$Validator.validateTree(Check.java:1350)
at com.sun.tools.javac.comp.Check.validate(Check.java:1221)
at com.sun.tools.javac.comp.Check.validate(Check.java:1218)
....
我的gradle是基本的:
compileSdkVersion 25
defaultConfig {
applicationId "com.br.xxxx"
minSdkVersion 16
targetSdkVersion 25
versionCode 45
versionName "3.0.2"
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.google.firebase:firebase-core:10.2.6'
compile 'com.google.firebase:firebase-database:10.2.6'
compile 'com.google.firebase:firebase-auth:10.2.6'
compile 'com.google.firebase:firebase-appindexing:10.2.6'
compile 'com.google.firebase:firebase-config:10.2.6'
compile 'com.firebaseui:firebase-ui:1.2.0'
compile 'com.firebase:geofire-java:2.1.1'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.github.PhilJay:MPAndroidChart:v2.2.0'
compile 'com.github.amlcurran.showcaseview:library:5.4.3'
compile 'com.andkulikov:transitionseverywhere:1.7.4'
compile 'com.google.android.gms:play-services-maps:10.2.6'
compile 'com.google.android.gms:play-services-location:10.2.6'
compile 'com.google.maps.android:android-maps-utils:0.5'
compile 'com.google.firebase:firebase-storage:10.2.6'
compile 'com.firebaseui:firebase-ui-storage:0.6.0'
compile 'com.jsibbold:zoomage:1.1.0'
compile "android.arch.persistence.room:runtime:1.0.0"
annotationProcessor "android.arch.persistence.room:compiler:1.0.0"
}
apply plugin: 'com.google.gms.google-services'
答案 0 :(得分:3)
我在Google的问题追踪器中添加了这个问题,他们回答说:
房间取决于26.1的支持库,这可能就是它的原因 因为SupportLibrary不承诺互操作而破坏 版本
并补充说:
您无法修复和匹配支持库版本。请匹配 无论您的依赖项最终需要什么最高版本。
然后问题得到解决,Room + lib仅支持库的26.1 +版本。
我的最后一点:
compileSdkVersion 26
defaultConfig {
applicationId "com.br.xxxx"
minSdkVersion 16
targetSdkVersion 26
versionCode 45
versionName "3.0.2"
}
...
repositories {
maven { url 'https://maven.fabric.io/public' }
maven { url 'https://maven.google.com' } }
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:26.1.0'
compile 'com.google.firebase:firebase-core:10.2.6'
compile 'com.google.firebase:firebase-database:10.2.6'
compile 'com.google.firebase:firebase-auth:10.2.6'
compile 'com.google.firebase:firebase-appindexing:10.2.6'
compile 'com.google.firebase:firebase-config:10.2.6'
compile 'com.firebaseui:firebase-ui:1.2.0'
compile 'com.firebase:geofire-java:2.1.1'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.github.PhilJay:MPAndroidChart:v2.2.0'
compile 'com.github.amlcurran.showcaseview:library:5.4.3'
compile 'com.andkulikov:transitionseverywhere:1.7.4'
compile 'com.google.android.gms:play-services-maps:10.2.6'
compile 'com.google.android.gms:play-services-location:10.2.6'
compile 'com.google.maps.android:android-maps-utils:0.5'
compile 'com.google.firebase:firebase-storage:10.2.6'
compile 'com.firebaseui:firebase-ui-storage:0.6.0'
compile 'com.jsibbold:zoomage:1.1.0'
compile "android.arch.persistence.room:runtime:1.0.0"
annotationProcessor "android.arch.persistence.room:compiler:1.0.0"
}