App not installed after upgrading to Android - P

耗尽温柔 提交于 2019-12-11 04:05:02

问题


App is installing while connecting via USB to mobile, but while sending .apk file to others it saying "App not Installed"(both debug and release).I have tried different solutions from stackoverflow but none worked for me.

1.How to overcome app not installed error when building from Android Studio 3.0?

2.Cannot install signed apk to device manually, got error "App not installed"

3.Android Studio 3.0 Unsigned Apk Not Installing

Below is my build.gradle(app level)

android {
    compileSdkVersion 'android-P'
    buildToolsVersion '26.0.2'
    defaultConfig {
        applicationId "XXXXXXX"
        minSdkVersion 15
        targetSdkVersion 26
        versionCode 51
        versionName "1.51"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled true
            shrinkResources true
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }

    }
    lintOptions{
        disable 'MissingTranslation'
    }

}

Please help me on this.Thanks in Advance.


回答1:


Android P preview SDK is a preview and you should not be distributing APKs built with it. Use a non-preview SDK for compiling APKs that are meant for other people to use.

Technically, the installation limitation is that the APKs have testOnly flag set to true. To work around that, see ADB Install Fails With INSTALL_FAILED_TEST_ONLY




回答2:


You can override testOnly flag adding following line to gradle.properties:

android.injected.testOnly=false


来源:https://stackoverflow.com/questions/49233866/app-not-installed-after-upgrading-to-android-p

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!