首页 > 解决方案 > 第三方 jar 文件中的 .so(共享库)无法进入 android studio 中的 apk 其他所有内容都进入其中

问题描述

我在多级子目录下有一个包含 .so 文件、dll 文件、数据文件和 java 类文件的第三方 jar 文件。当我在 Android Studio 中构建 apk 时,它会提取除 .so 文件之外的所有内容。如果我将 .so 文件的扩展名更改为 .so.1 (使用 jar 实用程序提取第三方 jar 文件以更改扩展名),它会将其拉入。

这是我的 build.gradle 文件:

plugins {
    id 'com.android.application'
}

android {
    compileSdkVersion 30
    buildToolsVersion '29.0.3'

    defaultConfig {
        applicationId "com.example.apicatjnovas"
        minSdkVersion 16
        targetSdkVersion 30
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }


    splits {
        abi {
            enable true
            reset()
            include 'x86', 'armeabi-v7a', 'mips'
            universalApk false
        }
    }
    ndkVersion '22.1.7171670'
    dependenciesInfo {
        includeInApk true
        includeInBundle true
    }
    buildTypes {
        release {
            minifyEnabled true
            shrinkResources true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        debug {
            renderscriptOptimLevel 3
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['.jar','.so'])
    implementation 'androidx.appcompat:appcompat:1.2.0'
    implementation 'com.google.android.material:material:1.3.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
    implementation files('libs/jnovas_hp.jar')
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.2'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
}

ndk 版本 - 21.1.6352462

任何帮助,将不胜感激。谢谢

标签: androidcandroid-studiojarapk

解决方案


推荐阅读