问题
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