java - Android Studio更新SDK 26后无法实例化一个或多个类

标签 java android xml gradle

下载 SDK 26 并更新我的项目后,我遇到了一些库冲突,但我已成功修复这些冲突。但我有一个持续存在的问题,它在论坛或 SO 中没有得到解决。

我的 XML 预览坏了。我可以构建并运行该程序,但因此我看不到任何东西:

enter image description here

我试过了:

  1. 将主题从 Theme.AppCompat.Light.DarkActionBar 更改为
    Base.Theme.AppCompat.Light.DarkActionBar
  2. Updating my gradle in a similar way
  3. 使缓存无效/重新启动
  4. 检查并更新了我所有的库并删除了所有关于 gradle 的错误
  5. 更改了预览中的 api
  6. 所有 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/

相关文章:

java - 在android studio上反序列化xml文件

php - 如何使用 php 生成带有 soap 信封和 body 标签的 XML

java - 递归图遍历

java - 如何使用java在Android studio中将线程增量数据插入到textview中

java - ExpandableListview 上的 LayoutTransition 动画无法正常工作

java - Android Studio 3.0.1 Gradle同步失败:原因:org.gradle.util.GFileUtils.unpack(Ljava/lang/Object;)Ljava/lang/Object;

java - 映射语句集合不包含 mybatis 映射器的值

java - 公共(public)ip套接字网络

java - @Service 是否保证 Spring 中的唯一性?

java - 安卓。如何使对话框按钮出现在对话框之外