当我将compileSdkVersion和tergetSdkVersion升级到25时,显示此错误;
我将版本缩减为23,错误是;
这是我的活动;
public class ExampleActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_my);
}
}
我的gradle文件; (这个项目是图书馆项目,我写错了。)
apply plugin: 'com.android.library'
buildscript {
repositories {
mavenCentral()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
}
}
dependencies {
compile 'com.google.android.gms:play-services-gcm:7.8.0'
compile 'com.android.support:appcompat-v7:25.3.0'
}
android {
compileSdkVersion 25
buildToolsVersion "25.0.1"
defaultConfig {
minSdkVersion 14
targetSdkVersion 25
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
instrumentTest.setRoot('tests')
debug.setRoot('build-types/debug')
release.setRoot('build-types/release')
}
}
有什么想法吗?
答案 0 :(得分:0)
我认为你也应该纠正你的依赖:
compile 'com.android.support:appcompat-v7:25.1.0'
在你的应用程序级别gradle依赖项中替换它后检查它。
答案 1 :(得分:0)
唯一真正有助于使用最新库的是:
//this will initialize multidex in your own Application class
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);}