首页 > 解决方案 > 应用程序在模拟器上运行良好,但应用程序无法通过 apk 包安装在移动设备上

问题描述

我使用 android studio 3.6 canary 3 为 android 5.1.1 编写了一个应用程序。移动设备是带有 5.1.1 android stock rom api22 的 samsung xcover 3 (sm-g388f)

在模拟器 5.1.1 api 22 上运行不会在 logcat 中显示任何错误,只是 E/libprocessgroup: failed to make and chown /acct/uid_10058: Read-only file system

应用程序已完成,并且可以在模拟器上完全运行。

构建调试构建类型 apk。我有电话空间。没有开发者游戏商店帐户,现在没有现金。我正在将 apk 压缩到 zip,通过 gmail 发送到手机,下载解压缩并安装。

我尝试了各种编译、构建工具版本。

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    buildToolsVersion "28.0.3"
    defaultConfig {
        applicationId "com.example.pippboy"
        minSdkVersion 22
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled true
            shrinkResources true


            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
            debuggable = true
        }
        debug {
            minifyEnabled  true
            shrinkResources true
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }

    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.appcompat:appcompat:1.0.2'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test.ext:junit:1.1.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
    implementation 'androidx.recyclerview:recyclerview:1.0.0'
    implementation 'com.google.android:flexbox:1.1.0'
    implementation 'com.google.android.material:material:1.0.0'
}

Apk 有 1mb。这是我的第一个应用程序。我只想通过从某个主机下载的 apk 包安装在移动设备上。

标签: androidgradle

解决方案


在设备上,您是否设置了安全选项以允许从不受信任的(即不是 Google Play 商店)来源安装 APK?你需要先允许它。您不必这样做,但您可能还希望允许在设备上进行 USB 调试。


推荐阅读