我已经在我更新的android工作室中导入了一个现有项目,当我打开项目文件时出现以下错误:
failed to instantiate one or more classes android studio
rendering failed with a known bug
The following classes could not be instantiated
-android.support.design.widget.AppCompatButton
-android.support.design.widget.AppCompatEditText
-android.support.design.widget.AppCompatTextView
这是我的build.gradle
文件:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion '25.0.3'
defaultConfig {
applicationId "com.lavazza"
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
allprojects {
repositories {
mavenCentral()
}
}
dexOptions {
incremental = true;
preDexLibraries = false
javaMaxHeapSize "2g"
}
productFlavors {
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.3-alpha', {
exclude group: 'com.android.support', module: 'support-annotations'
})
// Glide image library
//SUB-DEPENDENCIES
//Android-Iconics - used to provide an easy API for icons
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support:recyclerview-v7:25.3.1'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.android.support:cardview-v7:25.3.1'
compile 'com.mcxiaoke.volley:library-aar:1.0.0'
compile 'com.google.code.gson:gson:2.7'
compile 'com.jpardogo.materialtabstrip:library:1.0.9'
compile 'com.android.support:multidex:1.0.1'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.android.support:support-v4:25.3.1'
compile 'pl.droidsonroids.gif:android-gif-drawable:1.1.17'
compile 'com.google.android.gms:play-services:10.2.4'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.daimajia.slider:library:1.1.5@aar'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.weiwangcn.betterspinner:library-material:1.1.0'
compile 'com.mikepenz:actionitembadge:3.3.1@aar'
compile 'com.mikepenz:iconics-core:2.8.1@aar'
compile 'com.github.rey5137:material:1.2.2'
testCompile 'junit:junit:4.12'
compile 'com.android.support:mediarouter-v7:25.3.1'
testCompile 'junit:junit:4.12'
}
现在,我在Gradle
文件中没有收到任何错误。
我已经搜索并尝试了很多,我无法解决。 请有人帮助我。
答案 0 :(得分:0)
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion '25.0.3'
defaultConfig {
applicationId "com.lavazza"
minSdkVersion 15
targetSdkVersion 26
versionCode 1
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
allprojects {
repositories {
mavenCentral()
}
}
dexOptions {
incremental = true;
preDexLibraries = false
javaMaxHeapSize "2g"
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
// Glide image library
//SUB-DEPENDENCIES
//Android-Iconics - used to provide an easy API for icons
compile 'com.android.support:appcompat-v7:26.0.0-alpha1'
compile 'com.android.support:design:26.0.0-alpha1'
compile 'com.android.support:recyclerview-v7:26.0.0-alpha1'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.android.support:cardview-v7:26.0.0-alpha1'
compile 'com.mcxiaoke.volley:library-aar:1.0.1'
compile 'com.google.code.gson:gson:2.8.0'
compile 'com.jpardogo.materialtabstrip:library:1.1.1'
compile 'com.android.support:multidex:1.0.1'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.android.support:support-v4:26.0.0-alpha1'
compile 'pl.droidsonroids.gif:android-gif-drawable:1.1.17'
compile 'com.google.android.gms:play-services:8.3.0'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.daimajia.slider:library:1.1.5@aar'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.weiwangcn.betterspinner:library-material:1.1.0'
compile 'com.mikepenz:actionitembadge:3.3.1@aar'
compile 'com.mikepenz:iconics-core:2.8.1@aar'
compile 'com.github.rey5137:material:1.2.2'
testCompile 'junit:junit:4.12'
compile 'com.android.support:support-annotations:26.0.0-alpha1'
}