【问题标题】:app works fine on emulator but app can't be installed on mobile via apk package应用程序在模拟器上运行良好,但应用程序无法通过 apk 包安装在移动设备上
【发布时间】:2019-06-18 00:52:09
【问题描述】:

我使用 android studio 3.6 canary 3 为 android 5.1.1 编写了一个应用程序。 手机是 samsung xcover 3 (sm-g388f) with 5.1.1 android stock rom api22

在模拟器 5.1.1 api 22 上运行不会在 logcat 中显示任何错误 E/libprocessgroup: 无法创建和 chown /acct/uid_10058: 只读文件系统

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

构建调试构建类型 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 包安装在移动设备上。

【问题讨论】:

    标签: android gradle


    【解决方案1】:

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

    【讨论】:

    • 是的,是的,我在手机上完成了所有操作。允许通过 USB 进行未签名、不受信任的应用和调试。
    • 好的,那么,你能走多远?您是要下载 .zip 还是 .apk?您可以将 .apk 文件下载到“下载”吗?您可以安装它,但它无法运行?如果后者是,您可以尝试将设备插入 Android Studio 并在尝试运行您的应用程序时监控日志。
    • 我的手机上有 apk。安装开始... ... .. 安装。 . ... . . .安装。 ... . . . “应用无法安装”沟通
    • 当我使用手机“调试”并通过 USB 安装应用程序时,通过 android studio apk 已安装在手机上并正常工作
    • 可能是它试图安装应用程序的位置。转到设置/存储并点击首选安装位置。如果选中了 SD 卡的选项,请取消选中它。另外,选择让系统决定位置的选项。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-09-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多