gpt4 book ai didi

android - 从 Android Studio 运行时安装 APK 导致应用程序崩溃完美运行

转载 作者:塔克拉玛干 更新时间:2023-11-02 22:35:28 24 4
gpt4 key购买 nike

我最近将 Android Studio 更新到 2.3,将 SDK 更新到 25。现在,当我在我的手机或模拟器上从 Android Studio 运行应用程序时,它运行良好,但当我生成 APK 或从 App 获取 APK 并安装到设备上时,它崩溃了。

apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "lovestar.lycamobile"
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.2.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="lovestar.lycamobile">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:allowBackup="true"
android:icon="@mipmap/lycalogo"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name="lovestar.lycamobile.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="lovestar.lycamobile.Lyca"></activity>
</application>

最佳答案

我在 2-3 天前遇到过这个问题。它发生是因为即时运行功能。 App 的最新代码未正确构建在 APK 上,因此请从 Android Studio 菜单重建 APK

解决这个问题:

  1. Use Build APK option from Android Studio Menu and install in Mobile.

如果上面的步骤什么都不做,请参阅步骤 2

  1. Usually it's AndroidManifest.xml problem that does not have proper package name or activity with MAIN intent was not properly defined. That's easy fix.

关于android - 从 Android Studio 运行时安装 APK 导致应用程序崩溃完美运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42897998/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com