【问题标题】:App is not function correctly after uploaded to Play Console应用上传到 Play 管理中心后无法正常运行
【发布时间】:2022-11-04 16:57:21
【问题描述】:

我创建了一个 VPN 应用程序,它在发布和调试 APK 文件中正常工作,但是当我将它上传到 Play 商店,然后从 Play 商店下载时,它没有连接到服务器并说“没有进程运行" 并给我以下错误:

CANNOT LINK EXECUTABLE "/data/user/0/com.sharptech.sharpvpn/cache/c_pie_openvpn.arm64-v8a": library "libopenvpn.so" not found
pid: 3736, tid: 3736, name: c_pie_openvpn.a  >>> /data/user/0/com.sharptech.sharpvpn/cache/c_pie_openvpn.arm64-v8a <<<
Abort message: 'CANNOT LINK EXECUTABLE "/data/user/0/com.sharptech.sharpvpn/cache/c_pie_openvpn.arm64-v8a": library "libopenvpn.so" not found'

我的 Gradle 构建如下:

    plugins {
    id 'com.android.application'
    id 'com.google.gms.google-services'
}

android {
    compileSdk 32

    defaultConfig {
        applicationId "com.sharptech.sharpvpn"
        minSdk 21
        targetSdk 32
        versionCode 8
        resConfigs "en"
        versionName "1.7"
        android.defaultConfig.ndk.debugSymbolLevel = 'FULL'
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

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

    dependencies {
        implementation fileTree(dir: 'libs', include: ['*.jar'])
        implementation project(path: ':vpnLib')
        implementation platform('com.google.firebase:firebase-bom:31.0.1')
        implementation 'androidx.appcompat:appcompat:1.5.1'
        implementation 'com.google.android.material:material:1.7.0'
        implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
        implementation 'com.google.firebase:firebase-analytics:21.2.0'
        testImplementation 'junit:junit:4.13.2'
        androidTestImplementation 'androidx.test.ext:junit:1.1.3'
        androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
        implementation 'com.airbnb.android:lottie:5.2.0'
        implementation 'com.squareup.retrofit2:retrofit:2.9.0'
        implementation 'com.github.bumptech.glide:glide:4.14.2'
        annotationProcessor 'com.github.bumptech.glide:compiler:4.14.2'
        implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.1.0'
        implementation 'com.android.ndk.thirdparty:openssl:1.1.1l-beta-1'
        //ads
        //implementation 'com.google.android.gms:play-services-ads:21.3.0'
        //implementation 'com.google.ads.mediation:applovin:11.5.2.0'
        //implementation 'com.google.ads.mediation:facebook:6.11.0.1'
    }

我还使用了一个 vpnlib 模块,它的 build.gradle 文件是:

apply plugin: 'com.android.library'
android {
    compileSdk 32

    defaultConfig {
        minSdk 21
        targetSdk 32
        testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'

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

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.1.0'
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.3'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
    implementation 'androidx.appcompat:appcompat:1.5.1'
}

【问题讨论】:

    标签: android android-studio vpn google-play-console android-vpn-service


    【解决方案1】:

    看起来您的应用程序希望在安装时提取库 libopenvpn.so(通常是调试 APK 的情况),但这并不一定要发生。 Play 利用了一些可用的 Android 优化,允许应用直接从 APK 读取 .so 文件以节省设备空间。因此,您应该依赖 Android API 来加载 .so 文件。

    您可以在此答案https://stackoverflow.com/a/56551499/4265103 上阅读有关此内容的更多信息,该答案解释了加载 .so 文件的正确方法或如何完全禁用优化。

    【讨论】:

    • 您的回答真的很有帮助,它完成了我 3 周的调试和检查我的应用程序。你提供的链接真的很有帮助,我从那里得到了信息。
    【解决方案2】:

    我通过在build.gradle 文件中的android 部分中添加以下代码,通过@Pierre 的回答解决了我的问题,它解决了我的问题。

    packagingOptions {
        jniLibs {
            useLegacyPackaging = true
        }
    }
    

    【讨论】:

      【解决方案3】:
      1. 在您应用的 build.gradle 文件中添加:

         bundle {
             abi { enableSplit = false }
         }
        
      2. 在文件 gradle.properties 添加:

        android.bundle.enableUncompressedNativeLibs=false

        1. 您可以使用 bundletool 来获取 .apk 文件 => 将其安装在您的计算机上以查看该功能的运行情况。 Generate Apk file from aab file (android app bundle)

      【讨论】:

        猜你喜欢
        • 2010-11-04
        • 1970-01-01
        • 2018-06-18
        • 1970-01-01
        • 2020-01-19
        • 2020-08-03
        • 1970-01-01
        • 2023-03-31
        • 2019-06-01
        相关资源
        最近更新 更多