AutocompleteSupportFragmentshows me sometimes can't load search in kotlin android - android

I'm using AutocompleteSupportFragment in my kotlin android application for getting using place name , longitude and latitude which shows me error sometimes "No search found" but sometimes it works perfectly. When I read on google documentation it asks me to attach payment account and update the gradle etc.
I have attached payment account with this api but now it again shows me sometimes error that "no search found ".
Now i try to update my project libraries and code. When im using this library which is given below :
implementation 'com.google.android.libraries.places:places:1.0.0'
it works perfectly but when i updated my gradle with updated library i.e:
implementation 'com.google.android.libraries.places:places:2.2.0'
Compiler shows me error to add
tools:replace="android:appComponentFactory"
but then again it shows me error
Merging Errors: Error: tools:replace specified at line:14 for attribute android:appComponentFactory, but no new value specified app main manifest (this file), line 13 Error: Validation failed, exiting app main manifest (this file)
Now i can share my files with you
This is my manifestMerger
<?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.sprintsolutions.petsbuyandsell">
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<application
tools:replace="android:appComponentFactory"
android:allowBackup="false"
android:icon="#mipmap/icon"
android:label="#string/app_name"
android:roundIcon="#mipmap/icon"
android:usesCleartextTraffic="true"
android:supportsRtl="true"
android:largeHeap="true"
android:hardwareAccelerated="false"
android:theme="#style/AppTheme">
<uses-library
android:name="org.apache.http.legacy"
android:required="false"
/>
<activity android:name="com.sprintsolutions.petsbuyandsell.ContactUsActivity"
android:screenOrientation="portrait"/>
<activity
android:name="com.sprintsolutions.petsbuyandsell.AboutUsActivity"
android:screenOrientation="portrait">
</activity>
<activity android:name="com.sprintsolutions.petsbuyandsell.FullImageActivity"
android:screenOrientation="portrait"/>
<activity
android:name="com.sprintsolutions.petsbuyandsell.ForgetPasswordActivity"
android:screenOrientation="portrait"/>
<activity
android:name="com.sprintsolutions.petsbuyandsell.SplashActivity"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity
android:name="com.sprintsolutions.petsbuyandsell.SignUpActivity"
android:screenOrientation="portrait">
</activity>
<activity
android:name="com.sprintsolutions.petsbuyandsell.MainActivity"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustPan|stateHidden"/>
<activity
android:name="com.theartofdev.edmodo.cropper.CropImageActivity"
android:theme="#style/Base.Theme.AppCompat"/>
<activity
android:name="com.facebook.FacebookActivity"
android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
android:label="#string/app_name"/>
<activity
android:name="com.facebook.CustomTabActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
<data android:scheme="#string/fb_login_protocol_scheme"/>
</intent-filter>
</activity>
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="AIzaSyCLXlTj6IiZjtqjxIsemt7ZrmUJDDUww_I"/>
<meta-data
android:name="com.facebook.sdk.ApplicationId"
android:value="#string/facebook_app_id"/>
<activity
android:name="com.sprintsolutions.petsbuyandsell.MapsActivity"
android:label="#string/title_activity_maps"
android:screenOrientation="portrait"/>
<activity
android:name="com.sprintsolutions.petsbuyandsell.LoginActivity"
android:screenOrientation="portrait"/>
</application>
</manifest>
Now i can share gradle files
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
configurations.all {
resolutionStrategy.force 'com.google.code.findbugs:jsr305:1.3.9'
}
signingConfigs {
release {
storeFile file('/Users/HP/AndroidStudioProjects/PetMarket/upload')
storePassword 'a#b12345678'
keyAlias = 'upload'
keyPassword 'a#b12345678'
}
}
compileSdkVersion 28
defaultConfig {
applicationId "com.sprintsolutions.petsbuyandsell"
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
signingConfig signingConfigs.release
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
androidExtensions {
experimental = true
}
compileOptions {
sourceCompatibility 1.8
targetCompatibility 1.8
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:exifinterface:28.0.0'
implementation 'com.android.support:customtabs:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support:support-media-compat:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.google.android.gms:play-services-maps:16.0.0'
implementation 'com.google.android.gms:play-services-location:16.0.0'
implementation 'com.google.android.gms:play-services-places:16.0.0'
implementation 'com.google.android.libraries.places:places:2.2.0'
implementation 'com.karumi:dexter:5.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.android.support:design:28.0.0'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'com.android.volley:volley:1.1.1'
implementation 'com.nabinbhandari.android:permissions:3.8'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.google.code.gson:gson:2.8.5'
implementation 'com.github.bumptech.glide:glide:4.8.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.8.0'
implementation 'com.makeramen:roundedimageview:2.3.0'
implementation 'de.hdodenhof:circleimageview:3.0.0'
api 'com.theartofdev.edmodo:android-image-cropper:2.7.+'
implementation 'com.tbuonomo.andrui:viewpagerdotsindicator:3.0.3'
implementation 'com.facebook.android:facebook-android-sdk:[5,6)'
implementation 'com.google.android.gms:play-services-auth:16.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.twitter.sdk.android:twitter:3.3.0'
}

You should migrate to androidx to make it work

Related

android:exported needs to be explicitly specified

I have checked all activities in the manifest.xml file, all activities are present with android:exported="true" but it retainlessly showing this error **Manifest merger failed : android:exported needs to be explicitly specified for element <activity#im.dino.dbinspector.activities.DbInspectorActivity>. Apps targeting Android 12 and higher are required to specify an explicit value for android:exported when the corresponding component has an intent filter defined. See https://developer.android.com/guide/topics/manifest/activity-element#exported for details.
**
what should i do now?
my manifest file is
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="shubham.lists.happyplaces">
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.CAMERA" />
<application
android:allowBackup="true"
android:dataExtractionRules="#xml/data_extraction_rules"
android:fullBackupContent="#xml/backup_rules"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/Theme.HappyPlaces"
tools:targetApi="31">
<activity
android:name=".activities.AddHappyPlaceActivity"
android:exported="true"
android:label="ADD HAPPY PLACE"
android:screenOrientation="fullSensor"
android:theme="#style/CustomNoActionBarTheme"
tools:node="merge" />
<activity
android:name=".activities.MainActivity"
android:exported="true"
tools:node="merge">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
gradle build
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
}
android {
compileSdk 32
defaultConfig {
applicationId "shubham.lists.happyplaces"
minSdk 22
targetSdk 32
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 JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
buildFeatures{
viewBinding true
}
}
dependencies {
implementation 'de.hdodenhof:circleimageview:3.1.0'
implementation 'androidx.core:core-ktx:1.8.0'
implementation 'androidx.appcompat:appcompat:1.4.2'
implementation 'com.google.android.material:material:1.6.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'com.karumi:dexter:6.0.1'
debugImplementation 'im.dino:dbinspector:3.4.1#aar'
//androidTestImplementation "androidx.fragment:fragment-testing:<version>"
//androidTestImplementation 'androidx.test.ext:junit'
//androidTestImplementation "androidx.test.ext:junit:1.1.3"
//androidTestImplementation "androidx.compose.ui:ui-test-junit4:1.1.1"
//implementation 'androidx.core:core-ktx:1.8.0'
//implementation 'androidx.appcompat:appcompat:1.4.2'
//implementation 'com.google.android.material:material:1.6.1'
//implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'com.google.android.material:material:1.6.1'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}
WAITING FOR AN EARLY RESPONSSE
Try upgrading im.dino:dbinspector. You are on 3.4.1. The latest is 5.4.7. And based on the library's manifest in GitHub, this issue should be fixed.

Two apps installed with same package name

I am having a project in android studio in which I have only 1 package and while generating signed apk or debugging the app it installs 2 apk files, both are opening the same apk. I am not sure where the problem is. Can I get some suggestions?
<?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.myapplication">
<uses-permission
android:name="android.permission.INSTALL_LOCATION_PROVIDER"
tools:ignore="ProtectedPermissions" />
<application
android:name="androidx.multidex.MultiDexApplication"
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:hardwareAccelerated="true"
android:screenOrientation="portrait"
android:supportsRtl="true"
android:testOnly="false"
android:theme="#style/AppTheme"
android:usesCleartextTraffic="true"
tools:ignore="GoogleAppIndexingWarning,HardcodedDebugMode"
tools:targetApi="m">
<activity android:name="com.example.myapplication.Activity.ImageViewer" />
<activity
android:name="com.example.myapplication.Fragments.LeadManagement.ProcessingLeadUpdate"
android:theme="#style/AppTheme.NoActionBar" >
</activity>
<activity
android:name="com.example.myapplication.Activity.Splash"
android:configChanges="orientation|screenSize|keyboardHidden"
android:noHistory="false"
android:theme="#style/AppTheme.NoActionBar"
android:usesCleartextTraffic="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.example.myapplication.Activity.MainActivity"
android:configChanges="orientation|screenSize|keyboardHidden"
android:label="#string/app_name"
android:noHistory="false"
android:theme="#style/AppTheme.NoActionBar"
android:usesCleartextTraffic="true"
android:windowSoftInputMode="adjustResize" />
<activity
android:name="com.schibstedspain.leku.LocationPickerActivity"
android:label="#string/leku_title_activity_location_picker"
android:theme="#style/Theme.AppCompat.Light.NoActionBar"
android:windowSoftInputMode="adjustPan">
<meta-data
android:name="android.app.searchable"
android:resource="#xml/leku_searchable" />
</activity>
</application>
I think the problem is in the manifest file, so I am posting the manifest file here.
the build.gradle file in app level
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
configurations {
all {
exclude module: 'httpclient'
exclude module: 'json'
exclude group: 'org.apache.httpcomponents'
}
}
defaultConfig {
applicationId "com.example.myapplication"
minSdkVersion 17
targetSdkVersion 28
multiDexEnabled true
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
proguardFiles getDefaultProguardFile('proguard-android-
optimize.txt'), 'proguard-rules.pro'
debuggable false
}
}
compileOptions {
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.multidex:multidex:2.0.1'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.1.0-alpha05'
implementation 'androidx.appcompat:appcompat:1.1.0-alpha05'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta1'
implementation 'androidx.legacy:legacy-preference-v14:1.0.0'
implementation 'com.google.android.material:material:1.1.0-alpha06'
implementation 'com.fasterxml.jackson.core:jackson-core:2.9.8'
implementation 'com.fasterxml.jackson.core:jackson-annotations:2.9.8'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.9.8'
implementation 'com.squareup.okhttp3:okhttp:3.14.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
testImplementation 'junit:junit:4.12'
implementation 'com.goebl:david-webb:1.3.0'
implementation 'com.squareup.retrofit2:retrofit:2.5.0'
implementation 'com.squareup.retrofit2:converter-gson:2.5.0'
implementation 'de.hdodenhof:circleimageview:3.0.0'
implementation 'com.google.code.gson:gson:2.8.5'
implementation 'com.android.volley:volley:1.1.1'
implementation 'com.airbnb.android:lottie:3.0.0'
implementation 'com.github.aliumujib:Nibo:2.0'
implementation 'com.google.guava:guava:27.1-android'
implementation 'androidx.fragment:fragment:1.0.0'
implementation('com.schibstedspain.android:leku:6.1.1') {
exclude group: 'com.google.android.gms'
exclude group: 'androidx.appcompat'
}
implementation 'com.google.android.gms:play-services-location:16.0.0'
implementation 'com.google.android.gms:play-services-places:16.1.0'
implementation 'com.google.android.gms:play-services-maps:16.1.0'
implementation 'com.google.maps.android:android-maps-utils:0.5'
implementation 'com.github.prabhat1707:EasyWayLocation:1.0'
implementation 'com.ryanjeffreybrooks:indefinitepagerindicator:1.0.10'
implementation 'androidx.viewpager:viewpager:1.0.0'
implementation 'com.github.sharish:ShimmerRecyclerView:v1.3'
implementation 'com.facebook.shimmer:shimmer:0.4.0'
implementation 'com.github.developer-shivam:Crescento:1.2.1'
implementation 'io.reactivex.rxjava2:rxandroid:2.1.0'
implementation 'com.camerakit:camerakit:1.0.0-beta3.11'
implementation 'com.camerakit:jpegkit:0.1.0'
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.31'
implementation 'com.github.PauloLinhares09:RetroPicker:1.2.3-Beta1'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.0.0'
implementation 'com.jsibbold:zoomage:1.2.0'
implementation 'id.zelory:compressor:2.1.0'
compile 'com.github.hkk595:Resizer:v1.5'
}
It feels like your application is picking up activity from some library.
Open the AndroidManifest file. click on Merged Manifest tab (in the bottom of the IDE).
Search for Activity having LAUNCHER intent-filter.
If there is any LAUNCHER Activity other than yours, that is the culprit.
You can modify or update your library AndroidManifest file and remove the activity from the launcher. If that library is not your own and you can't update the AndroidManifest file, you should try some other library.
Here it go, now create your signed build or debug, you will have only one launcher icon.
If you are using customized SplashScreen, check into the AndroidManifest.xml file located on android\app\src\main\AndroidManifest.xml and look for the intent-filter tag like this:
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
Certifies that you have only one statement of the preview snippet of code, preferably in the .SplashActivity statement, like this:
<activity
android:name=".SplashActivity"
android:theme="#style/SplashScreenTheme"
android:label="#string/app_name"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
and your .MainActivity don't need to have intent-filter inside and will be like:
<activity
android:name=".MainActivity"
android:label="#string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize|uiMode"
android:launchMode="singleTask"
android:windowSoftInputMode="adjustResize"
android:exported="true">
<!-- ! DON'T ENNABLE the intent-filter tag here in the same time with .SplashActivity
to avoid duplicated app installation -->
<!-- <intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter> -->
</activity>

loginActivity is reopened after home key pressed in release mode

My problem is that if i open any activity in the app and then press the home key button .And then reopen the app the login activity is opened instead of opening the current activity the user actually in .
This happens only in release mode .
app manifest file
<?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.test">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />
<application
android:name="com.example.TestApp"
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"
android:networkSecurityConfig="#xml/network"
tools:node="merge">
<activity android:name=".pages.assitance.question.QuestionAnswerActivity" android:screenOrientation="portrait"></activity>
<activity android:name=".pages.tripdetails.TripDetailActivity" android:screenOrientation="portrait"/>
<activity android:name=".pages.profile.EditProfileActivity" android:screenOrientation="portrait"/>
<activity android:parentActivityName=".pages.main.MainActivity" android:name=".pages.QrActivity" android:screenOrientation="portrait"/>
<activity android:name=".pages.profile.ProfileActivity" android:screenOrientation="portrait"/>
<activity android:name=".pages.main.MainActivity" android:screenOrientation="portrait"/>
<activity android:name=".pages.login.LoginActivity" android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service android:name=".core.location.TestService" />
<service
android:name=".TestService"
android:exported="false">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
</application>
</manifest>
and gradle manifest file
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-android'
apply plugin: 'io.fabric'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.test"
minSdkVersion 21
targetSdkVersion 28
versionCode 2
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
debuggable true
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.config
}
debug {
// minifyEnabled true
// proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation project(':assi')
implementation project(':location')
implementation project(':notification')
implementation 'androidx.appcompat:appcompat:1.0.0-beta01'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.android.material:material:1.0.0-rc01'
implementation 'android.arch.lifecycle:extensions:1.1.1'
implementation 'androidx.legacy:legacy-support-v4:1.0.0-beta01'
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 "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
//butterknife
implementation 'com.jakewharton:butterknife:10.1.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:10.1.0'
//picasso
implementation 'com.squareup.picasso:picasso:2.5.2'
//lottie animation
implementation 'com.airbnb.android:lottie:3.0.0'
//qr
implementation 'me.dm7.barcodescanner:zxing:1.9'
//location
implementation 'com.google.android.gms:play-services-location:16.0.0'
// RxJava
implementation 'io.reactivex.rxjava2:rxjava:2.1.9'
implementation 'io.reactivex.rxjava2:rxandroid:2.0.1'
// Retrofit and OkHttp
// OkHttp interceptors for logging
implementation 'com.squareup.retrofit2:retrofit:2.4.0'
implementation 'com.squareup.retrofit2:converter-gson:2.4.0'
implementation 'com.jakewharton.retrofit:retrofit2-rxjava2-adapter:1.0.0'
implementation 'com.squareup.okhttp3:okhttp:3.10.0'
implementation 'com.squareup.okhttp3:okhttp-urlconnection:3.0.1'
implementation 'com.squareup.okhttp3:logging-interceptor:3.4.1'
//room
implementation 'androidx.room:room-runtime:2.0.0-beta01'
annotationProcessor 'androidx.room:room-compiler:2.0.0-beta01'
// use kapt for Kotlin
//phone number validation
implementation 'com.googlecode.libphonenumber:libphonenumber:8.2.0'
//socket.io
implementation('io.socket:socket.io-client:1.0.0') {
// excluding org.json which is provided by Android
exclude group: 'org.json', module: 'json'
}
//library for rating
implementation 'com.github.ome450901:SimpleRatingBar:1.4.2'
//firebase
implementation 'com.google.firebase:firebase-core:16.0.8'
//crashlytics
releaseImplementation 'com.crashlytics.sdk.android:crashlytics:2.10.0'
//firebase push notification
implementation 'com.google.firebase:firebase-messaging:18.0.0'
}
repositories {
mavenCentral()
}
apply plugin: 'com.google.gms.google-services'
if i run the app from android studio in debug or release mode it works normally
it happens only when i generate a release apk
any ideas ?
If you want to open the login activity only once and when you will logged in and reopen the app you want to open the home activity then just save the state of the app or save the login status in the shared preferences which you will compare on the splash and than decide that where should you go home activity or login activity.
Do this when you will get success after calling login function on login activity:
SharedPreferences pref = this.getSharedPreferences ("Login",0);
Editor editor = pref.Editor();
editor.putBoolean("login",true)
editor.commit();
Do this in the splash screen code:
Boolean loggedIn = SplashScreen.this.getSharedPreferences("Login",0) .getBoolean
("login",false);
if(loggedIn) {
startActivity(new Intent(SplashScreen.this,HomeActivity.class));
finish();
} else {
startActivity(new Intent(SplashScreen.this,LoginActivity.class));
finish();
}

Manifest merger failed (After deleting a few files)

I tried adding some new activities to my project, but had to delete them for some reasons. And then my project started giving Manifest merger failed
error. I did not update any thing as such.
I get the following error :
Manifest merger failed : Attribute meta-data#android.support.VERSION#value value=(25.4.0) from [com.android.support:design:25.4.0] AndroidManifest.xml:28:13-35
is also present at [com.android.support:support-v4:26.1.0] AndroidManifest.xml:28:13-35 value=(26.1.0).
Suggestion: add 'tools:replace="android:value"' to <meta-data> element at AndroidManifest.xml:26:9-28:38 to override.
Below is my AndroidManifest.xml file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.quickstart">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="Google Sheets API Android Quickstart"
android:theme="#style/AppTheme">
<activity
android:name=".MainActivity"
android:label="GBL"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
android:screenOrientation="landscape">
</activity>
<service android:name=".NotificationService" />
<receiver
android:name=".MyAlarmReceiver"
android:process=":remote" />
</application>
</manifest>
And this is my app build.gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.0"
defaultConfig {
applicationId "com.example.quickstart"
minSdkVersion 14
targetSdkVersion 25
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}
}
dependencies {
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
implementation 'com.android.support:design:25.4.0'
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:25.0.1'
compile 'com.google.android.gms:play-services-auth:12.0.1'
compile 'pub.devrel:easypermissions:0.3.0'
compile('com.google.api-client:google-api-client-android:1.23.0') {
exclude group: 'org.apache.httpcomponents'
}
compile('com.google.apis:google-api-services-sheets:v4-rev523-1.23.0') {
exclude group: 'org.apache.httpcomponents'
}
implementation 'com.github.PhilJay:MPAndroidChart:v2.2.4'
implementation files('libs/commons-net-3.6.jar')
testImplementation 'junit:junit:4.12'
}
I know this question has been asked tons of times but none of the answers seemed to help me a lot. Any help appreciated Thank you.
Set this manifest file :
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<application
android:allowBackup="fase"
android:icon="#mipmap/ic_launcher"
android:label="Google Sheets API Android Quickstart"
android:theme="#style/AppTheme">
<activity
android:name=".MainActivity"
android:label="GBL"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service android:name=".NotificationService" />
<receiver
android:name=".MyAlarmReceiver"
android:process=":remote" />
</application>
Your dependencies must all use the same version of the support library.
Try changing the following line compile 'com.android.support:appcompat-v7:25.4.0'
dependencies {
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
implementation 'com.android.support:design:25.4.0'
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:25.4.0'
compile 'com.google.android.gms:play-services-auth:12.0.1'
compile 'pub.devrel:easypermissions:0.3.0'
compile('com.google.api-client:google-api-client-android:1.23.0') {
exclude group: 'org.apache.httpcomponents'
}
compile('com.google.apis:google-api-services-sheets:v4-rev523-1.23.0') {
exclude group: 'org.apache.httpcomponents'
}
implementation 'com.github.PhilJay:MPAndroidChart:v2.2.4'
implementation files('libs/commons-net-3.6.jar')
testImplementation 'junit:junit:4.12'
}
Also, this is why you should use source control (git). When you run into an issue, you can just reset your repository to the last known working state.
You could do what your error says. Add 'tools:replace="android:value" to your manifest like so:
<application
...
android:theme="#style/AppTheme">
<meta-data
tools:replace="android:value">
...
</application>

DEX error Android Studio - Execution failed for task ':app:transformClassesWithMultidexlistForDebug'

I get this weird Error after adding a Spinner, it worked. I tried to fix some margin for it. Tried building it got this error
Execution failed for task ':app:transformClassesWithMultidexlistForDebug'.
Duplicate zip entry [classes.jar:android/support/design/widget/CoordinatorLayout$Behavior.class]
So, I tried removing the stuff I added. Didn't work. I tried clean the build project and rebuild, no success. It tried looking for a solution on stackoverflow. I came across, added multiDexEnabled true this to my app.gradle, no success.I also followed the documentation for it on Android link: https://developer.android.com/studio/build/multidex.html
This didn't work neither, so I came here my self. My gradle files:
app.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.example.meyil.androidlearning"
minSdkVersion 15
targetSdkVersion 26
multiDexEnabled true
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:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.google.firebase:firebase-auth:11.8.0'
implementation 'com.google.firebase:firebase-messaging:11.8.0'
implementation 'com.android.support:support-v4:26.1.0'
implementation 'com.google.firebase:firebase-database:11.8.0'
implementation 'com.google.firebase:firebase-storage:11.8.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
implementation 'com.android.support:design:26.1.0'
implementation 'de.hdodenhof:circleimageview:2.2.0'
implementation 'com.theartofdev.edmodo:android-image-cropper:2.6.+'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.firebaseui:firebase-ui-database:3.2.1'
implementation 'id.zelory:compressor:2.1.0'
implementation 'com.squareup.okhttp:okhttp:2.5.0'
implementation 'com.android.support:multidex:1.0.2'
}
apply plugin: 'com.google.gms.google-services'
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.meyil.androidlearning">
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application
android:name="android.support.multidex.MultiDexApplication"
android:allowBackup="true"
android:icon="#mipmap/spaced_launcher_logo"
android:label="#string/app_name"
android:roundIcon="#mipmap/spaced_launcher_logo_round"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<service android:name=".FirebaseMessagingService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".StartActivity" />
<activity
android:name=".RegisterActivity"
android:parentActivityName=".StartActivity" />
<activity
android:name=".LoginActivity"
android:parentActivityName=".StartActivity" />
<activity android:name=".SettingsActivity" />
<activity
android:name=".StatusActivity"
android:parentActivityName=".SettingsActivity" />
<activity
android:name="com.theartofdev.edmodo.cropper.CropImageActivity"
android:theme="#style/Base.Theme.AppCompat" />
<activity
android:name=".UsersActivity"
android:parentActivityName=".MainActivity" />
<activity android:name=".ProfileActivity">
<intent-filter>
<action android:name="com.example.meyil.androidlearning_TARGET_NOTIFICATION" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity android:name=".ChatActivity"
android:parentActivityName=".MainActivity"></activity>
</application>
</manifest>
build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.google.gms:google-services:3.1.0'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Yesterday had same problem, so inspected dependencies and after removed 'android.lib.recaptcha:reCAPTCHA:+' starts working fine, build was complited withoout any error. In my opinion you should also try to find conflicted dependency.
I fixed it by changing the compileSdk and targetSdk to 27 and all the other dependencies that were 26 to 27. :D

Categories

Resources