Android Studio error related to Google Play Services - android-studio

I get these errors while building a signed apk using Android Studio. Help me build the app please.
1.
Error:(42, 28) No resource found that matches the given name (at
'value' with value '#integer/google_play_services_version').
2.
Error:Execution failed for task ':app:processDebugResources'.
com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command
'/home/dna/Android/Sdk/build-tools/23.0.2/aapt'' finished with
non-zero exit value 1
This is my AndroidManifest.xml file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="appen.woltlab_bb"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="15"
android:targetSdkVersion="23" />
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="appen.woltlab_bb.SplashScreen"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="appen.woltlab_bb.MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="appen.woltlab_bb.MAINACTIVITY" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<!--
ATTENTION: This was auto-generated to add Google Play services to your project for
App Indexing. See https://g.co/AppIndexing/AndroidStudio for more information.
-->
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
</application>
</manifest>

I got it fixed. It was caused due to having accidentally including some auto generated API indexing code from a similar project by me. In case you have this issue, just start from scratch and be careful with what you import from your previous project.

Related

AndroidStudio says Could not identify launch activity: Default Activity not found"

The app works as expected. - it is only the IDE that apparently fail to upload/run it.
05/15 14:37:53: Launching 'app' on Google Glass 1. Install
successfully finished in 1 s 954 ms. Could not identify launch
activity: Default Activity not found Error while Launching activity
My manifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="no.ut.glassbrowser"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="19"
android:targetSdkVersion="19" />
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name">
<activity
android:immersive="true"
android:name=".MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="com.google.android.glass.action.VOICE_TRIGGER" />
</intent-filter>
<meta-data
android:name="com.google.android.glass.VoiceTrigger"
android:resource="#xml/voice_trigger" />
</activity>
</application>
</manifest>
What Am I missing?
In your "intent-filter" tag you should have this code
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />

Cause: duplicate entry: AndroidManifest.xml

I'm using a project downloaded from codecanyon.net, the project fails Gradle build with an error message. I tried reviewing other questions with a similar issue but none worked for me. Please anybody can help me fix this issue
Cause: duplicate entry: AndroidManifest.xml
Below is the 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.dreams.chat">
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.DISABLE_KEYGUARD" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<application
android:name=".BaseApplication"
android:allowBackup="false"
android:appComponentFactory="whateverString"
android:hardwareAccelerated="true"
android:icon="#drawable/ic_logo_"
android:label="#string/app_name"
android:largeHeap="true"
android:supportsRtl="true"
android:theme="#style/AppTheme"
android:usesCleartextTraffic="true"
tools:replace="android:allowBackup,android:appComponentFactory">
<activity
android:name=".activities.MainActivity"
android:launchMode="singleTop"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateHidden|adjustResize" />
<activity
android:name=".activities.ChatActivity"
android:parentActivityName=".activities.MainActivity"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateHidden|adjustResize">
<!--android:windowSoftInputMode="stateHidden|adjustResize|adjustPan">-->
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".activities.MainActivity" />
</activity>
<activity android:name=".activities.ImageViewerActivity" />
<service
android:name=".services.FirebaseChatService"
android:enabled="true" />
<service android:name=".services.MyFirebaseMessagingService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
<receiver
android:name=".receivers.ConnectivityReceiver"
android:enabled="true">
<intent-filter>
<action android:name="android.net.conn.CONNECTIVITY_CHANGE"
tools:ignore="BatteryLife" />
</intent-filter>
</receiver>
<!-- https://developers.google.com/places/android-sdk/signup -->
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="#string/google_maps_key" />
<provider
android:name=".utils.MyFileProvider"
android:authorities="#string/authority"
android:exported="false"
android:grantUriPermissions="true"
tools:replace="android:authorities">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="#xml/file_paths" />
</provider>
<activity
android:name=".activities.ContactViewerActivity"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateHidden|adjustResize" />
<activity
android:name=".activities.ChatDetailActivity"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateHidden|adjustResize" />
<activity
android:name=".activities.SignInActivity"
android:screenOrientation="portrait"
android:theme="#style/AppTheme.NoTitle"
android:windowSoftInputMode="stateHidden|adjustResize" />
<activity
android:name=".activities.CallScreenActivity"
android:screenOrientation="portrait" />
<activity
android:name=".activities.IncomingCallScreenActivity"
android:screenOrientation="portrait" />
<activity
android:name=".activities.SplashActivity"
android:screenOrientation="portrait"
android:theme="#style/AppTheme.NoTitle"
android:windowSoftInputMode="stateHidden|adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service
android:name=".services.FetchMyUsersService"
android:exported="false" />
<service
android:name=".services.SinchService"
android:enabled="true"
android:exported="false" />
<activity
android:name=".activities.ChooseSignInActivity"
android:label="#string/title_activity_choose_sign_in"
android:theme="#style/AppTheme" />
<activity
android:name=".activities.ContactActivity"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateHidden|adjustResize" />
<activity
android:name=".activities.PrivacyPolicyActivity"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateHidden|adjustResize" />
<meta-data
android:name="com.dreams.chat.status.glideProgressBar.OkHttpProgressGlideModule"
android:value="GlideModule" />
<activity
android:name=".activities.StatusStoriesActivity"
android:exported="true"
android:screenOrientation="portrait"
android:theme="#style/FullScreenVideoTheme" />
<activity
android:name=".activities.CallListActivity"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateHidden|adjustResize|adjustPan" />
</application>
</manifest>
and this is the excception detailed
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:mergeDebugAssets'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
> Failed to transform timezago-1.1.8.aar (com.chootdev:timezago:1.1.8) to match attributes {artifactType=android-assets, org.gradle.category=library, org.gradle.libraryelements=jar, org.gradle.status=release, org.gradle.usage=java-runtime}.
> Execution failed for JetifyTransform: C:\Users\JRAR\.gradle\caches\modules-2\files-2.1\com.chootdev\timezago\1.1.8\a988a24719cbe07115df73a045aa251630cdb10\timezago-1.1.8.aar.
> Failed to transform 'C:\Users\JRAR\.gradle\caches\modules-2\files-2.1\com.chootdev\timezago\1.1.8\a988a24719cbe07115df73a045aa251630cdb10\timezago-1.1.8.aar' using Jetifier. Reason: ZipException, message: duplicate entry: AndroidManifest.xml. (Run with --stacktrace for more details.)
Please file a bug at http://issuetracker.google.com/issues/new?component=460323.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.1.1/userguide/command_line_interface.html#sec:command_line_warnings
The issue was with allowbackup and appComponentFactory. I found lead to my solution in this question, if logs and build is not providing enough details about the issue, do check merged manifest it show errors with suggestions.
Open application manifest (AndroidManifest.xml) and click on Merged Manifest (in bottom) see image below.

Failed to parse XML in Android Manifest after update

I have an app I was working on a few months ago. Today I opened it again in Android Studio 3.4 and when syncing it asked if OK to upgrade to the current version of Gradle and the Gradle plug-in. I agreed and I now get an XML parsing error in the manifest.
The manifest is here, I added a comment to signal where I get the error:
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.schalkx.alarmapp01">
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.VIBRATE" />
<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/Theme.AppCompat">
<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=".SetAlarmActivity">
android:label="Alarm Settings"
android:parentActivityName=".MainActivity" <!-- *** I GET THE ERROR HERE *** -->
<!-- Parent activity meta-data to support 4.0 and lower -->
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".MainActivity" />
</activity>
<activity android:name=".ShowClockActivity">
android:label="Desktop Clock"</activity>
<receiver android:name=".AlarmReceiver" />
<activity
android:name=".UserResponseActivity"
android:label="#string/title_activity_user_response" />
<meta-data
android:name="preloaded_fonts"
android:resource="#array/preloaded_fonts" />
</application>
</manifest>
I did some tests adding a new activity and I noticed that the syntax is now generated a bit differently, and would start like this:
<activity
android:name=".SetAlarmActivity"
android:label="Alarm Settings"
android:parentActivityName=".MainActivity"
....
That is, the ">" is not added at the end of
<activity android:name=".SetAlarmActivity">
but later on. Trouble is I haven't been able to get the syntax right.
Any ideas what's wrong?
Thanks!
It should be
<activity android:name=".SetAlarmActivity"
android:label="Alarm Settings"
android:parentActivityName=".MainActivity"> //<--Notice
Instead of
<activity android:name=".SetAlarmActivity"> //<--Notice
android:label="Alarm Settings"
android:parentActivityName=".MainActivity"

How to fix problem with run app on android studio?

I Work with Android Studio 3.2 and i have problem with Run app because not working and get me "App Default Activity not found"
Problem -> https://imgur.com/a/2Q0SGUq
This code is manifest for app
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.erik.firebaseauthdemo">
<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">
<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=".LoginActivity" />
<activity android:name=".RegisterActivity" />
<activity android:name=".ForgetAndChangePasswordActivity"></activity>
</application>
</manifest>

Error while generating APK

I'm trying to generate an APK from Android Studio for publish it on the play store.
Now when i generate the APK i got this error:
I can start the app but "Generate APK" not work and for avoid this error i copy my Facebook App Id from my string.xml to my manifest:
android:value="2132153153153535"
Instead of:
android:value="#string/facebook_app_id"
Now i can generate the APK but when i launch my app from the playstore i got this error:
Unable to start activity ComponentInfo{com.stable.giamma.sushichallenge/com.stable.giamma.sushichallenge.MenuActivity}: java.lang.IllegalArgumentException: Both context and applicationId must be non-null
That i can resolve by reversing the modify that i just did.
But if i do so i can't generate the APK again.....
What is the right way for handle the "facebook app id" and generate the APK?
p.s: i have 2 string.xml (one is for english and the other for italian language) dunno if create some problem...
Here is my manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.asd.appname">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
o
<application
android:allowBackup="true"
android:icon="#mipmap/asd"
android:label="#string/app_name"
android:largeHeap="true"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<meta-data
android:name="com.facebook.sdk.ApplicationId"
android:value="#string/facebook_app_id" /> //THIS IS THE STRING THAT I MODIFY FOR AVOID THE FIRST ERROR
<activity
android:name="com.asd.MainActivity"
android:label="#string/app_name"
android:screenOrientation="landscape"
android:theme="#style/AppTheme.NoActionBar" />
<activity
android:name="com.facebook.FacebookActivity"
android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
android:label="#string/app_name"
android:theme="#android:style/Theme.Translucent.NoTitleBar" />
<activity
android:name="com.asd.MenuActivity"
android:screenOrientation="portrait"
android:theme="#style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.asd.SushataActivity"
android:label="#string/sushata"
android:parentActivityName="com.asd.MenuActivity">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.asd.MenuActivity" />
</activity>
<activity
android:name="com.asd.Sushata2Activity"
android:label="#string/sushata2"
android:parentActivityName="com.asd.SushataActivity">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.asd.SushataActivity" />
</activity>
<activity
android:name="com.asd.Leaderboard"
android:screenOrientation="portrait"
android:theme="#style/AppTheme.NoActionBar"></activity>
</application>
I added:
tools:ignore="ManifestResource"
The correct code is:
<meta-data
android:name="com.facebook.sdk.ApplicationId"
android:value="#string/facebook_app_id"
tools:ignore="ManifestResource"/>
Now seems work I found this stackoverflow post helpful: link

Resources