英文:
Functioning App crashing on installing on Android device
问题
我的应用在早期版本中运行良好,在模拟器和设备上也没有问题。现在我通过 USB 将项目复制到另一台电脑上,在没有任何问题的情况下进行了调试构建和普通构建,并尝试在我的设备上安装它。问题就从这里开始。无论如何,当我尝试安装 .apk 文件时,应用安装程序都会崩溃。
我在 Android Studio 中尝试过的事项:
-
清理项目和构建项目
-
清除所有缓存并构建项目
我在手机上尝试过的事项:
- 卸载了旧的应用版本
包安装程序在我的设备上持续崩溃。
有什么想法我可以尝试吗?
英文:
My app ran/runs fine in an earlier version and without problems in the emulator and on my device. Now I have copied the project via usb to another pc after not having any issues and I made a debug-build and one normal build and tried to install it on my device. This is where the problems start. No matter what, the app-installer crashes when I try to install the .apk.
Things I tried in Android Studio:
-
Clean Project & Make project
-
Clear all caches & Make project
Things I tried on my Phone:
- Unistalled the older App-Version
The package-installer keeps crashing on my device.
Any Ideas what I can try?
答案1
得分: 0
去打开 build.gradle 文件(Module:app,在 Gradle Script 下),然后检查 android 下的属性,你会看到 minSdkVersion 和 compileSdkVersion。
android {
compileSdkVersion 29
defaultConfig {
applicationId "com.yourapp_package"
minSdkVersion 19
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
将 API 等级更改为与你的设备 API 匹配(已安装的 Android 操作系统版本)。
重新构建并在你的设备上进行测试。
英文:
Go to build.gradle (Module:app, under Gradle Script) and check properties under android, you will see minSdkVersion and compileSdkVersion.
android {
compileSdkVersion 29
defaultConfig {
applicationId "com.yourapp_package"
minSdkVersion 19
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
Change the api level to match it to your device api (android OS installed).
Rebuid and test it to your device.
答案2
得分: 0
问题是我将一些 PNG 格式的图像用作应用程序图标,这导致安装应用程序时应用程序崩溃。我使用这些 PNG 图像制作了自己的资源,现在它可以正常运行。
英文:
The problem was that i put in some pngs as app logo that made the app crash on installing. I made my own assets out of these pngs and now it works like a charm
专注分享java语言的经验与见解,让所有开发者获益!
评论