下载 SDK 26 并更新我的项目后,我遇到了一些库冲突,但我已成功修复这些冲突。但我有一个持续存在的问题,它在论坛或 SO 中没有得到解决。
我的 XML 预览坏了。我可以构建并运行该程序,但因此我看不到任何东西:
我试过了:
- 将主题从
Theme.AppCompat.Light.DarkActionBar
更改为
Base.Theme.AppCompat.Light.DarkActionBar
- Updating my gradle in a similar way
- 使缓存无效/重新启动
- 检查并更新了我所有的库并删除了所有关于 gradle 的错误
- 更改了预览中的 api
- 所有 SDK 均已更新。
在我更新到 SDK 26 之前一切都很好。所有可用的解决方案都不起作用。非常感谢帮助
编辑
我的 gradle.build
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
android {
compileSdkVersion 26
buildToolsVersion "26.0.0"
defaultConfig {
applicationId "gr.softweb.sakouli"
minSdkVersion 19
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LGPL2.1'
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile project(path: ':linkedin-sdk')
compile('com.crashlytics.sdk.android:crashlytics:2.6.8@aar') {
transitive = true;
}
// configurations.all {
// resolutionStrategy.eachDependency { DependencyResolveDetails details ->
// def requested = details.requested
// if (requested.group == 'com.android.support') {
// if (!requested.name.startsWith("multidex")) {
// details.useVersion '26.0.1'
// }
// }
// }
// }
compile 'com.facebook.android:facebook-android-sdk:4.26.0'
compile 'com.android.support:appcompat-v7:26.0.0-alpha1'
compile 'com.android.support:design:26.0.0-alpha1'
compile 'com.android.support:customtabs:26.0.0'
compile 'com.koushikdutta.ion:ion:2.2.1'
compile 'com.google.code.gson:gson:2.8.1'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'de.hdodenhof:circleimageview:2.1.0'
compile 'com.roughike:bottom-bar:2.3.1'
compile 'com.ncapdevi:frag-nav:2.0.1'
compile 'com.google.android.gms:play-services-maps:11.0.4'
compile 'co.lujun:androidtagview:1.1.4'
compile 'com.google.android.gms:play-services-gcm:11.0.4'
compile 'com.braintreepayments.api:drop-in:3.1.0'
testCompile 'junit:junit:4.12'
apply plugin: 'com.google.gms.google-services'
}
最佳答案
更新以下内容:
compile 'com.android.support:appcompat-v7:26.+'
compile 'com.android.support:design:26.+'
以下解决了我的问题:
compile 'com.android.support:appcompat-v7:26.0.0-alpha1'
compile 'com.android.support:design:26.0.0-alpha1'
Build.gradle 文件:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.0"
defaultConfig {
applicationId "com.example.myandroidgoogleappengine"
minSdkVersion 15
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE-FIREBASE.txt'
exclude 'META-INF/NOTICE'
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:26.0.0-alpha1'
compile 'com.android.support:design:26.0.0-alpha1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
compile 'com.google.firebase:firebase-database:11.2.2'
}
apply plugin: 'com.google.gms.google-services'
关于java - Android Studio更新SDK 26后无法实例化一个或多个类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46114327/