未在发行版本中安装的本机库

时间:2019-11-07 16:56:53

标签: android kotlin build.gradle android-native-library

我在让ffmpeg在我的发行版本中工作时遇到问题。在我的调试版本上,它工作得很好。我正在从本地库目录加载ffmpeg,因此它符合Android Q中的最新更改。调试版本发现该库很好,但是当我构建发行版本时,它说该文件不存在。当我分析APK时,在相应的arch文件夹中看到这些库。

我尝试过按Architectur拆分apk并使用abi过滤器。都不起作用。

这是我的build.gradle:

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: 'io.fabric'
apply plugin: 'com.google.firebase.firebase-perf'

android {
    signingConfigs {
        release {
            storeFile ******
            storePassword *****
            keyAlias = *****
            keyPassword *****
        }
    }
    compileSdkVersion 29
    buildToolsVersion "29.0.2"
    defaultConfig {
        applicationId "com.example.app"
        minSdkVersion 21
        targetSdkVersion 29
        versionCode 27
        versionName "2.0-beta19"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        ndk {
            // Tells Gradle to build outputs for the following ABIs and package
            // them into your APK.
            abiFilters 'x86', 'x86_64', 'armeabi-v7a', 'arm64-v8a'
        }
    }
    sourceSets.main {
        assets.srcDirs = ['assets']
        jni.srcDirs = [] //disable automatic ndk-build
        jniLibs.srcDirs = ['src/main/resources/lib']
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
            signingConfig signingConfigs.release
        }
    }

    dataBinding {
        enabled = true
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    packagingOptions {
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/license.txt'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/notice.txt'
        exclude 'META-INF/ASL2.0'
        exclude 'META-INF/atomicfu.kotlin_module'
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'androidx.core:core-ktx:1.1.0'
    implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.1.1"
    implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.1.1"
    implementation "androidx.lifecycle:lifecycle-extensions:2.1.0"
    implementation "com.jakewharton.timber:timber:4.7.1"
    implementation "com.github.bumptech.glide:glide:4.8.0"
    implementation "androidx.room:room-runtime:2.2.1"
    implementation "android.arch.work:work-runtime-ktx:1.0.1"
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'androidx.recyclerview:recyclerview:1.1.0-rc01'
    implementation 'com.github.piasy:rxandroidaudio:1.6.0'
    implementation 'com.github.piasy:AudioProcessor:1.6.0'
    implementation 'com.google.android.material:material:1.2.0-alpha01'
    implementation 'com.github.iammert:CameraVideoButton:0.2'
    implementation 'com.google.firebase:firebase-core:17.2.1'
    implementation 'com.google.firebase:firebase-ads:18.3.0'
    implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'
    implementation 'com.google.firebase:firebase-perf:19.0.1'
    implementation 'com.android.billingclient:billing:1.2.2'

    kapt "androidx.room:room-compiler:2.2.1"

    api 'com.otaliastudios:cameraview:2.2.0'

    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.2.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
    implementation 'androidx.cardview:cardview:1.0.0'
}

apply plugin: 'com.google.gms.google-services'

我只是无法解释为什么它可以用于调试版本,而不是在签名后才能使用。谁能对此有所启示?

0 个答案:

没有答案