Android Studio mengeluh tentang kelas JNI yang hilang [duplikat]

Mengapa Android Studio saya tidak menemukan kelas JNI terkait?

Saya memiliki kelas di dalam AsyncTask bernama opensslSign yang terkait dengan file jni .so, libcryptowrapper.so. Build berfungsi dengan baik tetapi Android Studio mengeluh: "Tidak dapat menyelesaikan fungsi JNI yang sesuai". Saya telah memindahkan file .so saya ke beberapa folder hanya untuk melihat apakah Android menemukannya, tetapi tidak berhasil.

Ini adalah tangkapan layar yang menunjukkan bahwa Android Studio dapat menemukan kelas JNI di file .so dan di file jni direktori kelas (berisi Android.mk)

Kelas saya:

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.3'
    }
}

apply plugin: 'com.android.application'

dependencies {
    compile 'com.android.support:multidex:1.0.1'
    compile 'com.android.support:appcompat-v7:25.0.0'

    compile fileTree(dir: 'libs', include: '*.so')
    compile fileTree(dir: 'lib', include: '*.jar')

    compile(name:'google-maps-sdk-m4b', ext:'aar')
    compile(project(':deps:android-map-utils:library'))  {
        exclude group: 'com.android.support', module: 'support-v4'
    }
    compile 'com.google.android.gms:play-services:11.0.4'
    compile "com.google.android.gms:play-services-location:11.0.4"

    compile group: 'org.apache.james', name: 'apache-mime4j', version: '0.6'

    compile group: 'commons-codec', name: 'commons-codec', version: '1.10'
    compile group: 'commons-io', name: 'commons-io', version: '2.5'

    compile group: 'net.lingala.zip4j', name: 'zip4j', version: '1.3.2'
    compile group: 'net.sf.kxml', name: 'kxml2', version: '2.3.0'
    compile group: 'net.sf.opencsv', name: 'opencsv', version: '2.3'
    compile group: 'joda-time', name: 'joda-time', version: '2.9.5'
}

android {
    compileSdkVersion 24
    buildToolsVersion '25.0.0'

    useLibrary 'org.apache.http.legacy'

    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  'jsr305_annotations/Jsr305_annotations.gwt.xml'
        exclude  'build-data.properties'
    }

    defaultConfig {
        // Already hit dex limit
        multiDexEnabled true
        dexOptions {
            javaMaxHeapSize "4g"
        }
    }

    sourceSets {
        main {
            manifest.srcFile 'AndroidManifest.xml'
            java.srcDirs = ['src']
            aidl.srcDirs = ['src']
            renderscript.srcDirs = ['src']
            res.srcDirs = ['res']
            assets.srcDirs = ['assets']
            jniLibs.srcDirs = ['libs']
        }

        // Move the tests to tests/java, tests/res, etc...
        instrumentTest.setRoot('tests')

        // Move the build types to build-types/<type>
        // For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
        // This moves them out of them default location under src/<type>/... which would
        // conflict with src/ being used by the main source set.
        // Adding new build types or product flavors should be accompanied
        // by a similar customization.
        debug.setRoot('build-types/debug')
        release.setRoot('build-types/release')
    }
    lintOptions {
        abortOnError false
    }
    splits {
        abi {
            enable true
            reset()
            include 'x86', 'armeabi-v7a'
            universalApk true
        }
    }
}

repositories {
    flatDir{
        dirs 'libs'
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

person Rijvi Rajib    schedule 18.05.2018    source sumber
comment
Silakan baca stackoverflow.com/a/44422873/192373, saya harap ini menjawab pertanyaan Anda   -  person Alex Cohn    schedule 18.05.2018
comment
Inilah jawaban yang saya cari-cari. Terima kasih.   -  person Rijvi Rajib    schedule 19.05.2018


Jawaban (1)


Menghapus

splits { abi { aktifkan true reset() sertakan 'x86', 'armeabi-v7a' universalApk true } }

Sekarang dikelola secara otomatis oleh Android studio.

person Sunil    schedule 18.05.2018
comment
Terima kasih. Saya sudah menghapusnya, build masih berfungsi seperti yang diharapkan tetapi Android Studio masih mengeluhkan kesalahan tautan. - person Rijvi Rajib; 18.05.2018