【问题标题】:Hello World Android project is not installing in REDMi Note 5REDMi Note 5 中未安装 Hello World Android 项目
【发布时间】:2019-12-22 07:33:24
【问题描述】:

我已经在我的 windows 7 64-Bit 机器上准备了一个新的 android 开发设置。

Android Studio 版本: 3.5.3

JDK: 1.8.0_231

build.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 29
    buildToolsVersion "29.0.2"
    defaultConfig {
        applicationId "com.example.myapplication"
        minSdkVersion 21
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test.ext:junit:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}

AndroidManufest.java

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:dist="http://schemas.android.com/apk/distribution"
    package="com.example.myapplication">

    <dist:module dist:instant="true" />

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

当我在模拟器(Nexus 6P API 27 x86)中安装编译后生成的 APK 文件时,它工作正常。但是,当我尝试在手机中安装相同的 APK 文件时,它没有安装。我已经停用了 Play Protect 选项。

【问题讨论】:

  • 您是使用 android 运行按钮安装应用程序还是从输出文件夹生成 APK?你有什么错误吗?如果是请添加。
  • @AliSadeghi 我已经生成构建文件(app-debug.apk),然后放在移动下载目录并从那里安装。
  • 你检查this了吗?
  • 在小米你需要登录小米帐号才能安装应用程序,即使在启用开发者 optinos 之后也是如此
  • @ked 已经登录,没有运气:(

标签: android android-studio adb


【解决方案1】:

禁用 wifi 和移动数据并进行构建,然后在手机上安装 apk 我在我的应用中看到了这个问题,它看起来像谷歌保护的东西

【讨论】:

  • 即使在禁用 WiFi 和移动数据后也无法正常工作。
【解决方案2】:
 debug {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }

解决了我的问题。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-10-02
    • 1970-01-01
    • 2019-04-11
    • 1970-01-01
    • 2012-08-22
    • 1970-01-01
    相关资源
    最近更新 更多