gpt4 book ai didi

java - Gradle不会将JNI库添加到AAR

转载 作者:行者123 更新时间:2023-12-03 05:50:18 29 4
gpt4 key购买 nike

我有一个库项目,其中包含SDK.jar,其中包含带有* .so libs的libs文件夹。

enter image description here

我将此 jar 添加到我的图书馆项目中,如下所示

enter image description here

问题在于,输出的.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'
}

最佳答案

我在库项目中将implementation files('libs/SDK.jar')替换为compileOnly files('libs/SDK.jar'),并将implementation files('libs/SDK.jar')添加到示例项目中。

关于java - Gradle不会将JNI库添加到AAR,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48210583/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com