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

时间:2018-04-03 12:12:33

标签: android android-studio kotlin

我无法打开我从android studio build > Generate Signed APK构建的APK。构建顺利,没有错误,但我无法打开APK来安装它。

仅供参考我已经从某个地方尝试过另一个APK,我可以打开它,所以它不是我的手机问题或安全性。

如何解决这个问题?我迷路了,因为没有错误。它只是说can't open file

这是我的傻瓜

     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'

3 个答案:

答案 0 :(得分:1)

使用以下流程为您创建签名APK

  • Build>生成Signed apk。
  • 创建Keystore路径。
  • 放置Password, alias,password
  • 构建类型(Release的{​​{1}})。
  • 签名版本选择Play StoreV1这两个复选框。
  • V2

更新

此外,您可能需要检查是否已安装了具有相同Finish的应用。转到设置==>应用==>点击你的App ==>在操作栏菜单的应用信息页面中,会有一个名为package name的选项,点击该按钮。

答案 1 :(得分:0)

使用Ionic 4构建的Android应用程序时,我也遇到了同样的问题。

一旦我构建了应用并获得了apk,我将使用Android Studio打开它,然后在菜单中选择

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

因此,当我从存档中打开生成的APK时,我可以将其安装在我的设备上

答案 2 :(得分:0)

关注本文:https://docs.microsoft.com/en-us/xamarin/android/deploy-test/signing/manually-signing-the-apk

我遇到了同样的问题,解决方法是自己签名apk。通常,IDE负责此操作,但有时却无法完成。