我成功导入了ActionBarActivity的lib,但是当我构建项目时, 它得到以下错误帮助我。
Compilation failed to complete
错误:
Program type already present: android.support.v7.app.ActionBar$LayoutParams
Message{kind=ERROR, text=Program type already present: android.support.v7.app.ActionBar$LayoutParams, sources=[Unknown source file], tool name=Optional.of(D8)}
这是我的Gradle文件代码:
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.hsdsolution.hamza.sqliteimplementation"
minSdkVersion 14
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:27.1.1'
// implementation 'com.android.support:design:27.1.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation files('libs/android-support-v4.jar')
implementation files('libs/android-support-v7-appcompat.jar')
}
答案 0 :(得分:0)
您要为appcompat-v7
添加3次依赖关系...
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:27.1.1'
// implementation files('libs/android-support-v7-appcompat.jar')
删除文件libs/android-support-v7-appcompat.jar
,它应该生成。