У меня есть один проект (MyProject), в котором есть один модуль библиотеки (customlib), этот модуль библиотеки использует один файл jar commontask.jar, который я импортировал в модуль int. Я также хочу использовать тот же файл JAR в проекте Android. Я импортировал этот модуль (customlib) в MyProject, но если я попытался получить доступ к классу (CustomActivity.java) из lib, то из-за ошибки он не может получить доступ к CustomActivity.java.
файл пользовательской библиотеки
apply plugin: 'com.android.library'
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation files('libs/customtask.jar')
}
Файл проекта Myproject
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
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:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
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 project(':customlib')
}
если я импортирую этот customtask.jar в этот проект и когда я сгенерирую apk, его ошибка выдачи
Program type already present: com.task.common.Helper