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>
Related
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
I have this error when I try to build my app:
Merging Errors: Warning
activity#com.google.firebase.auth.internal.FederatedSignInActivity#android:launchMode
was tagged at AndroidManifest.xml:24 to replace other declarations but
no other declaration present app main manifest (this file), line 23
<?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.dm.bloggerapp">
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET"/>
<application
tools:ignore="GoogleAppIndexingWarning"
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">
<activity android:name=".Activities.HomeActivity" />
<activity android:name=".Activities.RegisterActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Build.gradle:
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0-rc01'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.firebase:firebase-core:17.2.0'
implementation 'com.google.firebase:firebase-auth:19.0.0'
implementation 'com.google.firebase:firebase-storage:19.0.1'
implementation 'com.google.firebase:firebase-database:19.1.0'
implementation 'com.google.android.material:material:1.1.0-alpha10'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.0-alpha4'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0-alpha4'
}
I think it is related to Firebase libraries I imported. In my manifest I have nothing related to android:launchMode. Any idea how can I fix this?
Thanks guys!
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>
I just released my app on the google play store. My testing device is an older nexus 5 running 6.0.1, but I have a friend with a new android phone, and the app is not available for either phone on the play store.
There is no maxSdkVersion, and the mindSdkVersion is 17, which should work on 6.0.1 according to the android versions.
Here is my manifest:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-feature android:name="android.hardware.camera" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<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.NoActionBar"
android:name="android.support.multidex.MultiDexApplication">
<activity android:name=".LauncherActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".LoginActivity" />
<activity android:name=".RegisterActivity" />
<activity android:name=".ForgotPasswordActivity" />
<activity
android:name=".MainNavigationActivity"
android:label="#string/title_activity_main_navigation"
android:theme="#style/AppTheme.NoActionBar" />
<receiver
android:name="com.google.android.gms.gcm.GcmReceiver"
android:exported="true"
android:permission="com.google.android.c2dm.permission.SEND">
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
</intent-filter>
</receiver>
<service
android:name=".services.PushGcmListenerService"
android:exported="false">
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
</intent-filter>
</service>
<service
android:name=".services.PushInstanceIDListenerService"
android:exported="false">
<intent-filter>
<action android:name="com.google.android.gms.iid.InstanceID" />
</intent-filter>
</service>
<service
android:name=".services.RegistrationIntentService"
android:exported="false" />
</application>
And here is my gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "#####"
minSdkVersion 17
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
multiDexEnabled = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/notice.txt'
exclude 'META-INF/ASL2.0'
}
}
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.android.support:design:26.1.0'
implementation 'com.android.support:support-v4:26.1.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'
// 3rd part
compile 'com.android.support:multidex:1.0.0'
compile 'br.com.simplepass:loading-button-android:1.12.0'
compile 'org.apache.directory.studio:org.apache.commons.io:2.4'
compile 'com.google.code.gson:gson:2.8.2'
compile 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
//required support lib modules
implementation "com.android.support:recyclerview-v7:26.1.0"
implementation "com.android.support:support-annotations:26.1.0"
compile 'com.github.pavlospt:circleview:1.3'
compile 'com.google.android.gms:play-services-gcm:12.0.0'
apply plugin: 'com.google.gms.google-services'
//compile group: "com.twilio.sdk", name: "twilio", version: "7.18.0"
SOLUTION:
compile 'org.apache.directory.studio:org.apache.commons.io:2.4'
This reference had to be removed and a new APK published. After it was removed the Google Play console recognized 12k+ devices for the new build.
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