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
Related
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'
}
apply plugin: 'com.android.application'
android
{
compileSdkVersion 24
buildToolsVersion "28.0.3"
defaultConfig {
applicationId "com.example.asus.salestrackingsystem"
minSdkVersion 15
targetSdkVersion 24
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:design:25.3.1'
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.google.firebase:firebase-auth:16.0.5'
compile 'com.google.firebase:firebase-database:16.0.5'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
but still cant success to add realtime database , firebase assistant keep asking to add the realtime database to your app . anyone can help me?
Follow the below links.
https://blog.mindorks.com/firebase-realtime-database-android-tutorial
https://github.com/MChehab94/Firebase-Realtime-Database-Demo
https://www.simplifiedcoding.net/firebase-realtime-database-crud/
https://www.vogella.com/tutorials/Firebase/article.html
https://www.androidtutorialpoint.com/firebase/firebase-database-tutorial/
https://proandroiddev.com/firebase-android-playground-realtime-database-560d4e18404a
add these dependencies to integrate firebase realtime database:
implementation 'com.google.firebase:firebase-auth:16.1.0' // this is for user registration
implementation 'com.google.firebase:firebase-database:16.0.5' // this for database
implementation 'com.google.firebase:firebase-core:16.0.5' // this is for core functionality
implementation 'com.google.firebase:firebase-messaging:17.3.4' // this is for notifications
implementation 'com.google.firebase:firebase-storage:16.0.5' // this is for storage
implementation 'com.google.android.gms:play-services-auth:16.0.1' // this is for user authentication
classpath 'com.google.gms:google-services:4.2.0' // this will be added in project level gradle file
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"
I'm adding Firebase Storage to upload images for my app, however after adding the dependency; I get the following errors:
My build.gradle(app) looks like this.
It is sadly not possible for me to use a higher SDK version as its a school project and we are limited to SDK 19...
Tried some multidex but couldn't make it work...
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "com.project.socker"
minSdkVersion 19
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'
}
}
compileOptions {
sourceCompatibility = 1.8
targetCompatibility = 1.8
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.preference:preference:1.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'androidx.navigation:navigation-fragment:2.1.0'
implementation 'androidx.navigation:navigation-ui:2.1.0'
def nav_version = "2.1.0"
implementation 'com.google.firebase:firebase-analytics:17.2.1'
implementation 'com.google.firebase:firebase-auth:19.1.0'
implementation 'com.google.firebase:firebase-core:17.2.1'
implementation 'com.google.firebase:firebase-database:19.2.0'
implementation 'com.google.firebase:firebase-storage:19.1.0'
....\Socker\app\src\main\java\com\project\socker\MainActivity.java:
uses or overrides a deprecated API.
Recompile with -Xlint:deprecation for details.
OR
Cannot fit requested classes in a single dex file (# methods: 65924 > 65536)
Used a lower version like
implementation'com.google.firebase:firebase-storage:16.0.4'
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'