UnsatisfiedLinkError:在Android调试版本中找不到“ libadblockplus-jni.so”

时间:2019-05-09 18:21:38

标签: android android-webview adblock

我正在使用AdblockWebView

  

https://github.com/adblockplus/libadblockplus-android

在我的Android应用中。我有三种构建类型:“发布”,“调试”和“开发”,并且在测试“开发”构建类型时Webview正在工作。

但是,当我启动“ debug”类型(与仅使用配置常量的“ dev”不同)时,当我完全没有理由打开webview活动时,应用程序崩溃。

java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/app....debug-W8BipJfr6wKqz06J0zWgrQ==/base.apk"],nativeLibraryDirectories=[/data/app/app...debug-W8BipJfr6wKqz06J0zWgrQ==/lib/arm64, /data/app/app....debug-W8BipJfr6wKqz06J0zWgrQ==/base.apk!/lib/arm64-v8a, /system/lib64, /system/vendor/lib64]]] couldn't find "libadblockplus-jni.so"
    at java.lang.Runtime.loadLibrary0(Runtime.java:1011)
    at java.lang.System.loadLibrary(System.java:1657)
    at org.adblockplus.libadblockplus.Platform.<clinit>(Platform.java:27)
    at org.adblockplus.libadblockplus.android.AdblockEngine$Builder.createEngines(AdblockEngine.java:265)
    at org.adblockplus.libadblockplus.android.AdblockEngine$Builder.build(AdblockEngine.java:250)
    at org.adblockplus.libadblockplus.android.SingleInstanceEngineProvider.createAdblock(SingleInstanceEngineProvider.java:174)
    at org.adblockplus.libadblockplus.android.SingleInstanceEngineProvider.access$100(SingleInstanceEngineProvider.java:35)
    at org.adblockplus.libadblockplus.android.SingleInstanceEngineProvider$1.run(SingleInstanceEngineProvider.java:211)
    at java.lang.Thread.run(Thread.java:764)

我尝试删除“ dev”构建类型,但这无济于事。我尝试在网上搜索了几个小时,但发现唯一相关的是this

build.gradle

apply plugin: 'com.android.application'

apply plugin: 'kotlin-android'

apply plugin: 'kotlin-android-extensions'

apply plugin: 'kotlin-kapt'

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

android {
    signingConfigs {
        config {
            keyAlias 'androiddebugkey'
            keyPassword 'android'
            storeFile file('C:/Users/Name/.android/debug.keystore')
            storePassword 'android'
        }
    }
    compileSdkVersion 28
    defaultConfig {
        applicationId "app.example"
        minSdkVersion 21
        targetSdkVersion 28
        versionCode 15
        versionName "1.3.9"
        multiDexEnabled true
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        signingConfig signingConfigs.config
    }
    buildTypes {
        debug {
            applicationIdSuffix ".debug"
            debuggable true
            resValue "string", "app_name", "example debug"
            buildConfigField "String", "BACKEND_URL", '"https://api.example.com/"'
        }
        dev {
            applicationIdSuffix ".dev"
            debuggable true
            resValue "string", "app_name", "example dev"
            buildConfigField "String", "BACKEND_URL", '"https://dev.example.com/"'
            signingConfig signingConfigs.config
        }
        release {
            resValue "string", "app_name", "example"
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            buildConfigField "String", "BACKEND_URL", '"https://api.example.com/"'
        }
    }
    kapt {
        generateStubs = true
    }
    buildToolsVersion '28.0.3'
    productFlavors {
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation files('libs/YouTubeAndroidPlayerApi.jar')
    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.0.0'
    implementation 'com.jakewharton.threetenabp:threetenabp:1.1.0'
    implementation 'org.adblockplus:adblock-android-webview:3.0'
    implementation 'com.github.bumptech.glide:recyclerview-integration:4.8.0'
    implementation 'com.google.android:flexbox:0.3.2'
    implementation 'com.google.dagger:dagger:2.16'
    implementation 'com.google.dagger:dagger-android:2.16'
    implementation 'com.google.dagger:dagger-android-support:2.16'
    kapt 'com.google.dagger:dagger-android-processor:2.16'
    implementation 'com.andkulikov:transitionseverywhere:1.8.0'
    kapt 'com.google.dagger:dagger-compiler:2.16'
    implementation 'com.squareup.retrofit2:retrofit:2.4.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.4.0'
    implementation 'com.github.rubensousa:gravitysnaphelper:1.5'
    implementation 'com.github.takusemba:multisnaprecyclerview:1.3.4'
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'com.github.bumptech.glide:glide:4.8.0'
    kapt 'com.github.bumptech.glide:compiler:4.8.0'
    implementation 'org.slf4j:slf4j-nop:1.7.25'
    implementation 'com.github.stfalcon:stfalcon-imageviewer:0.1.0'
    implementation 'com.vk:androidsdk:1.6.9'
    implementation 'com.appyvet:materialrangebar:1.4.4'
    implementation 'com.github.ome450901:SimpleRatingBar:1.4.2'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'androidx.lifecycle:lifecycle-runtime:2.0.0'
    implementation 'androidx.lifecycle:lifecycle-extensions:2.0.0'
    implementation 'androidx.room:room-runtime:2.1.0-alpha04'
    kapt 'androidx.room:room-compiler:2.1.0-alpha04'
    implementation 'androidx.paging:paging-runtime:2.1.0'
    implementation 'androidx.appcompat:appcompat:1.0.2'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'com.google.android.material:material:1.0.0'
    implementation 'androidx.cardview:cardview:1.0.0'
    implementation 'androidx.recyclerview:recyclerview:1.0.0'
    implementation 'com.facebook.android:facebook-android-sdk:[4,5)'
    implementation 'io.sentry:sentry-android:1.7.16'
    implementation 'com.google.android.gms:play-services-gcm:16.1.0'
    implementation 'com.mixpanel.android:mixpanel-android:5.4.4'
    implementation 'com.amplitude:android-sdk:2.16.0'
    implementation 'io.branch.sdk.android:library:3.0.4'
    implementation 'com.android.support:customtabs:28.3.0'
    // Chrome Tab matching
    implementation 'com.google.firebase:firebase-core:16.0.7'
    implementation 'com.google.firebase:firebase-messaging:17.4.0'
    implementation 'com.google.firebase:firebase-appindexing:17.1.0'
    implementation 'com.google.android.gms:play-services-auth:16.0.1'
    // App indexing
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
    debugImplementation 'com.amitshekhar.android:debug-db:1.0.4'
}

com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true

2 个答案:

答案 0 :(得分:1)

它没有在应用程序的libs文件夹中生成 libadblockplus-jni.so

对我来说,更新到Android Gradle 3.5.0后开始发生。将其更改回3.4.2后,它可以正常工作。

尝试在项目结构中将您的Android Gradle插件版本更改为3.4.2, 文件>项目结构>项目

Project Structure Menu

答案 1 :(得分:1)

我遇到了同样的问题

implementation 'org.adblockplus:adblock-android-webview:3.0'

但将 Gradle 插件版本降级为 3.4.2 有效,但我需要使用 Gradle 插件版本为 4.1 进行数据绑定。更新到

implementation 'org.adblockplus:adblock-android-webview:4.0'

它现在正在工作。我在项目结构中使用了 gradle plugin version 4.1.1gradle version 6.5。我能够屏蔽大部分广告,但仍有 5% 的广告绕过它。

  • 另请注意:这个 adblockplus 库使您的 apk 变得很大。就我而言,将 apk 大小从 11MB 更改为 33 MB。在 Playstore 上发布时使用捆绑包