简体   繁体   English

无法打开(安装)从 android studio 构建的 apk

[英]can't open (to install) apk built from android studio

I cant open APK that I built from android studio build > Generate Signed APK .我无法打开我从 android studio build > Generate Signed APK the build went smooth without error but I could not open the APK to install it.构建过程顺利,没有错误,但我无法打开 APK 来安装它。

FYI I already tried another APK from somewhere and I could open it, so it's not my phone issue or security.仅供参考,我已经从某个地方尝试了另一个 APK,我可以打开它,所以这不是我的手机问题或安全问题。

how to fix this?如何解决这个问题? I am lost because there is no error.我迷路了,因为没有错误。 it just says can't open file .它只是说can't open file

this is my gradle这是我的毕业证书

     apply plugin: 'com.android.application'

     apply plugin: 'kotlin-android'

     apply plugin: 'kotlin-android-extensions'

     android {
    compileSdkVersion 26
    defaultConfig {
        applicationId "com.mockie.daikokuten"
        minSdkVersion 15
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        vectorDrawables.useSupportLibrary = true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    }

     dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.android.support:support-v4:26.1.0'
    implementation 'com.android.support:design:26.1.0'
    implementation 'com.android.support:recyclerview-v7:26.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    implementation 'com.android.support:support-vector-drawable:26.1.0'
    implementation 'com.google.firebase:firebase-messaging:11.8.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
    compile "org.jetbrains.anko:anko-sqlite:0.10.3"
    compile 'com.squareup.retrofit2:retrofit:2.3.0'
    compile "com.squareup.retrofit2:converter-moshi:2.0.0"
    compile 'com.android.volley:volley:1.1.0'
    implementation files('libs/tscsdk.jar')
}
apply plugin: 'com.google.gms.google-services'

Create you Signed APK with below process.使用以下过程创建您的签名 APK

  • Build > Generate Signed apk. Build > 生成Signed apk。
  • Create Keystore path.创建Keystore路径。
  • Put Password, alias, key password . Password, alias, key password
  • Build type ( Release for Play Store ).构建类型( ReleasePlay Store )。
  • Signature Version select V1 and V2 both checkboxes inside this. Signature Version 选择V1V2这两个复选框。
  • Finish

Update更新

Also you may need to check that if an app is already installed with same package name .此外,您可能需要检查是否已经安装了具有相同package name的应用package name Go to Settings ==> Apps ==> Click on your App ==> In App info page at the action bar menu there will be an option called Uninstall for All users click that.转到设置 ==> 应用程序 ==> 单击您的应用程序 ==> 在操作栏菜单的应用程序信息页面中,将有一个名为“ Uninstall for All users的选项Uninstall for All users单击该选项。

I was facing kind of the same issue with an Ionic 4 build Android app.我在使用 Ionic 4 构建 Android 应用程序时遇到了同样的问题。

Once I built my app and got an apk, I open it with Android Studio then in menu I choose构建应用程序并获得 apk 后,我使用 Android Studio 打开它,然后在菜单中选择

Build > Build Bundle(s) / APK(s) > Build APK(s)

so I can install my apk on my device when I open the generated apk from Archive所以当我从存档打开生成的 apk 时,我可以在我的设备上安装我的 apk

Follow this article : https://docs.microsoft.com/en-us/xamarin/android/deploy-test/signing/manually-signing-the-apk按照这篇文章: https : //docs.microsoft.com/en-us/xamarin/android/deploy-test/signing/manually-signing-the-apk

I had the same issue and the solution was to sign the apk by yourself.我遇到了同样的问题,解决方案是自己签署 apk。 Generally, the IDE is responsible of this operation but sometimes it doesn't do the job.通常,IDE 负责此操作,但有时它不会完成这项工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM