我有一个拥有SDK.jar的库项目,它有一个包含* .so libs的libs文件夹。
我将这个jar添加到我的库项目中,如下所示
问题是输出.aar文件只有SDK.jar中的Java类,但没有带* .so libs的libs文件夹。
如果我将我的库项目添加到示例项目,它工作正常,最终apk有.so库,但是当我添加.aar库时,它没有.so库并且工作不正确。
此外,自从我将gradle插件更新为3.0.0后,它已经开始发生。
我的图书馆项目的完整build.gradle
。
apply plugin: 'com.android.library'
apply plugin: 'com.jakewharton.butterknife'
apply plugin: 'com.github.dcendents.android-maven'
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.jakewharton:butterknife-gradle-plugin:8.4.0'
}
}
android {
compileSdkVersion rootProject.ext.compileSdkVersion
defaultConfig {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion 26
versionCode 42
versionName "beta 1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
mock {
initWith(buildTypes.debug)
}
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/rxjava.properties'
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation files('libs/SDK.jar')
implementation 'io.reactivex:rxjava:1.2.2'
implementation 'io.reactivex:rxandroid:1.2.1'
implementation 'com.tbruyelle.rxpermissions:rxpermissions:0.9.4@aar'
implementation 'com.jakewharton.rxbinding:rxbinding:0.4.0'
implementation 'com.arello-mobile:moxy:1.5.3'
annotationProcessor 'com.arello-mobile:moxy-compiler:1.5.3'
implementation 'com.jakewharton:butterknife:8.4.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.4.0'
implementation 'com.squareup.retrofit2:retrofit:2.3.0'
implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
implementation 'com.squareup.retrofit2:adapter-rxjava:2.1.0'
mockImplementation 'com.squareup.retrofit2:retrofit-mock:2.1.0'
implementation 'com.squareup.okhttp3:logging-interceptor:3.9.0'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.pushtorefresh.storio:sqlite:1.13.0'
implementation 'com.pushtorefresh.storio:sqlite-annotations:1.13.0'
annotationProcessor 'com.pushtorefresh.storio:sqlite-annotations-processor:1.13.0'
implementation 'com.google.code.gson:gson:2.8.2'
implementation 'com.google.dagger:dagger:2.14.1'
annotationProcessor 'com.google.dagger:dagger-compiler:2.14.1'
implementation "com.android.support:appcompat-v7:${rootProject.ext.supportVersion}"
implementation "com.android.support:support-v4:${rootProject.ext.supportVersion}"
implementation "com.android.support:support-media-compat:${rootProject.ext.supportVersion}"
implementation "com.android.support:recyclerview-v7:${rootProject.ext.supportVersion}"
implementation "com.android.support:customtabs:${rootProject.ext.supportVersion}"
implementation "com.google.android.gms:play-services-location:${rootProject.ext.playServices}"
implementation 'com.jpardogo.materialtabstrip:library:1.1.0'
implementation 'com.joshdholtz.sentry:sentry-android:1.5.0'
implementation 'com.github.chrisbanes:PhotoView:2.1.3'
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
testImplementation 'junit:junit:4.12'
}
答案 0 :(得分:0)
我在我的图书馆项目中将implementation files('libs/SDK.jar')
替换为compileOnly files('libs/SDK.jar')
,并将implementation files('libs/SDK.jar')
添加到我的示例项目中。