APK generated using Android Studio is not getting installed on certain devices - java

I generated an apk with Android Studio without problem, but when I try to Install in my phone android v4.4.2 this error show me "
the app was not installed"
I don't understand, this is the configuration:
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.ejemplogpsmaps"
minSdkVersion 19
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
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.android.gms:play-services-maps:16.1.0'
}
then I tried to install on another phone, Samsung Galaxy s4 android v5.0.1 and the same error was displayed

First, check if the app been installed via USB.
then check if the flavour is release and not debug. if it's in debug then try building another one with the release version selected

Android Jelly Bean 4.2.x is actually API level 17, which has to be declared accordingly:
minSdkVersion 17
And also, the Google Play Services plugin is missing:
apply plugin: "com.google.gms.google-services"

Related

How to fix failed to add navigation dependency android studio java

I tried to add a new project using the existing template Navigation Drawer Activity. It really works well. However, I accidentally deleted the mobile_navigation.xml in res/navigation. Now that every time I tried to open a simple template (even if it is not Navigation Drawer Activity) I'm getting the below error message.
I tried:
File/Invalidate Cache/Restart: but it doesn't work
I found this implementation 'androidx.navigation:navigation-fragment-ktx:2.3.5' implementation 'androidx.navigation:navigation-ui-ktx:2.3.5' to update gradle but I think it is for kotlin. I'm using Java on Android Studio 3.6.2
I even tried creating a new project using templates Botton Navigation Activity. However, it is also not working and the same error occurs.
I even tried Empty Activity. Then it is weird that I'm getting an Android resource linking failed error. And it directs to a .XML (value.xml) of some of my other projects in a different folder which is not even related to this new project. I didn't even open it.
I would appreciate any suggestion to fix this. Thank you!
build.gradle is as below
apply plugin: 'com.android.application'
android {
compileSdkVersion 29
buildToolsVersion "29.0.3"
defaultConfig {
applicationId "com.example.test"
minSdkVersion 16
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.4.1'
implementation 'com.google.android.material:material:1.5.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
implementation 'androidx.vectordrawable:vectordrawable:1.1.0'
implementation 'androidx.navigation:navigation-fragment:2.4.1'
implementation 'androidx.navigation:navigation-ui:2.4.1'
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}

apk file is not installed in any android phone with android 10,11,12 but install in android 9 or less

I am an Android developer and I finished a project and built an apk file using Android Studio (create a key and then extract the apk file), but when I manually installed the application on my Xiaomi Android 11 phone, it showed me an error message shown in the picture, and when I tried it with my friends, the same problem occurred On phones with Android 10, 11 and 12, but when I tested it on Android 9, the application was installed, so what is the solution to this problem??[the error message when installing the apk][1]
[1]: https://i.stack.imgur.com/zZWqR.jpg
plugins {
id 'com.android.application'
}
android {
compileSdkVersion 31
defaultConfig {
applicationId "com.bodykh.IslamyatApp"
minSdkVersion 22
targetSdkVersion 31
versionCode 1
versionName "1.0"
testInstrumentationRunner
"androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
implementation 'com.google.android.material:material:1.2.1'
implementation 'com.google.android.gms:play-services-maps:18.0.2'
implementation 'com.google.android.gms:play-services-
location:19.0.1'
testImplementation 'junit:junit:4.13.2'
implementation 'com.android.volley:volley:1.2.1'
implementation 'com.github.rommansabbir:AnimationX:2.0'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-
core:3.4.0'
}

Android Application using Firebase database keeps crashing when launching?

So I am currently trying to store user details into a database, however the program does not mention any errors upon execution, but the application keeps on crashing when trying to open it. This is my error code in logcat:
Code gist will be provided upon request
build.gradle
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 30
buildToolsVersion "30.0.2"
defaultConfig {
applicationId "com.example.finalyearprojectapp"
minSdkVersion 19
targetSdkVersion 30
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 'com.android.support:multidex:1.0.3'
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.1'
implementation 'com.google.firebase:firebase-auth:16.0.5'
implementation 'com.google.firebase:firebase-firestore:22.1.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
}
try adding multidex support
defaultConfig {
// Your previous stuffs
multiDexEnabled true
}
for more info you can visit this thread. This can be helpful too: https://stackoverflow.com/a/39831657/7237222

Firebase Auth working with WiFi but not with mobile data

I get this error when I'm trying to login with mobile data on my Firebase App:
"A network error (such as timeout, interrupted connection or unreachable host) has occurred."
My app was working perfectly until I tried to log in with mobile data on my new smartphone (It's working fine with my old one) and I'm running out of ideas concerning the source of the problem. Here are the things I've already tried"
Check data restrictions, data limit and permission.
Reset the APN.
Check Network Provider: I put my new SIM card in my older phone and it's working fine and when I was sharing that connection on my new Phone it was also working.
Check android version: I thought that maybe it was the Android version (API 28) of my new phone the problem but it's working fine for other users with API 28 version.
I also tried to change to 2G or 3G but not that didn't work.
Check google play services : it's activated
Here's my gradle file:
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.caroloucl"
minSdkVersion 23
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.google.firebase:firebase-auth:16.0.5'
implementation 'com.google.firebase:firebase-core:16.0.5'
implementation 'com.google.firebase:firebase-database:16.0.5'
implementation 'com.google.firebase:firebase-storage:16.0.5'
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 'de.hdodenhof:circleimageview:2.2.0'
}

Program type already present: com.google.android.gms.ads.identifier.AdvertisingIdClient$Info

Whenever i build my project in android studio it gives me the following error
Program type already present: com.google.android.gms.ads.identifier.AdvertisingIdClient$Info
below is my build.gradle file
lastly the line that has implementation 'com.android.support:design:27.0.0' also gives an error saying...
All com.android.support libraries must use the exact same version specification
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.example.iwatchug"
minSdkVersion 19
targetSdkVersion 27
versionCode 1
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:design:27.0.0'
implementation 'com.google.firebase:firebase-auth:16.2.1'
implementation 'com.google.firebase:firebase-core:16.0.8'
implementation 'com.google.android.gms:play-services-maps:15.0.1'
implementation 'com.google.android.gms:play-services:7+'
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'
}
repositories {
google()
}
apply plugin: 'com.google.gms.google-services'
Remove the following line:
implementation 'com.google.android.gms:play-services:7+'
From the docs:
Note: Don't use the combined play-services target. It brings in dozens of libraries, bloating your application. Instead, specify only the specific Google Play services APIs your app uses.
You need to add specific google play services library, example:
implementation 'com.google.android.gms:play-services-vision:17.0.2'

Categories

Resources