6
I am facing a problem when trying to generate an app apk developed in Android Studio. After generating the . apk to install the app on other phones, the app is installed but does not open.
On mobile phones with android 9 it presents error "Application presents faults continuously" and on other versions of android it presents error "Application stopped working".
The mode I use to generate apk is: Build menu -> Generate Signed Bundle/APK... and I follow the steps of generating key, registering etc. I have managed other applications in the same way and I have not had any problems. To debug the application I use both a physical device (Android 8.0) as emulators (varied Android versions) and at least this way the application does not show errors, neither in the part Debug screen nor in Logcat. I’m gonna post here my Manifest and Gradle.
Manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.example.wqueiroz.publictaxi">
<uses-permission android:name="android.permission.INTERNET" />
<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"
tools:ignore="GoogleAppIndexingWarning">
<activity
android:name=".UI.MainActivity"
android:label="@string/app_name"
android:theme="@style/AppTheme.NoActionBar"></activity>
<activity android:name=".UI.UI.ScanActivity" />
<activity android:name=".UI.UI.InformacoesViagemActivity" />
<activity android:name=".UI.UI.PerfilActivity" />
<activity android:name=".UI.UI.CreditosActivity" />
<activity android:name=".UI.UI.LoginActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".UI.UI.CadastroActivity"></activity>
</application>
</manifest>
Gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.wqueiroz.publictaxi"
minSdkVersion 17
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner
"android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support:support-vector-drawable:28.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.google.zxing:core:3.2.1'
implementation 'com.journeyapps:zxing-android-embedded:3.2.0@aar'
implementation 'de.hdodenhof:circleimageview:3.0.1'}
Note: I already looked for some answer here on the site for this problem: Application does not work on a particular device after compiled and Problems to generate APK in Android Studio, but they didn’t solve my situation.
If anyone can give a hint of how I can resolve this situation I thank you already.
Have you tried migrating the project to Androidx? If I’m not mistaken you have the documentation from Google itself that was instructing all developers to migrate their projects to the most current version of the SDK if I’m not mistaken to targetSDK 28, can also try to migrate it to Androidx, maybe solve your problem
– Matheus
@Q. Wesley, I have seen problems of this kind and if they were missing libs, maybe you are using features that are not available for the versions you are testing, or there is a loss of libs during packaging.
– Vinicius Dutra
Assuming the application is working in debug mode (with the phone plugged into the computer and running in Android Studio), you have to look at the logcat microscopically. There are several errors that are forgiven during debug mode but not when generating an APK. If you have nothing suspicious, then you need to look at the logcat of the APK execution.
– epx