Android studio [AndroidManifest.xml] I can't run the program - android

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.my"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="25"
android:targetSdkVersion="33" />
<permission
android:name="com.example.my.DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION"
android:protectionLevel="signature" />
<uses-permission android:name="com.example.my.DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION" />
<application
android:allowBackup="true"
android:appComponentFactory="androidx.core.app.CoreComponentFactory"
android:dataExtractionRules="#xml/data_extraction_rules"
android:debuggable="true"
android:extractNativeLibs="false"
android:fullBackupContent="#xml/backup_rules"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/Theme.My" >
<activity
android:name="com.example.my.MainActivity"
android:exported="true" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<provider
android:name="androidx.startup.InitializationProvider"
android:authorities="com.example.my.androidx-startup"
android:exported="false" >
<meta-data
android:name="androidx.emoji2.text.EmojiCompatInitializer"
android:value="androidx.startup" />
<meta-data
android:name="androidx.lifecycle.ProcessLifecycleInitializer"
android:value="androidx.startup" />
</provider>
</application>
</manifest>
I decided to create a light program and nothing starts for about 5 hours, I think. what is the problem? I just started learning Kotlin yesterday.
Errors:
Attribute android:versionCode is not allowed here
Attribute android:versionName is not allowed here
Attribute android:protectionLevel is not allowed here
Attribute android:allowBackup is not allowed here
Attribute android:appComponentFactory is not allowed here
Attribute android:dataExtractionRules is not allowed here
Attribute android:extractNativeLibs is not allowed here
Attribute android:fullBackupContent is not allowed here
Attribute android:icon is not allowed here
Attribute android:supportsRtl is not allowed here
Attribute android:theme is not allowed here
Unresolved class 'InitializationProvider'
Attribute android:exported is not allowed here
simple code that prevents it from running on the phone.
I'm new and don't understand anything. What to do?

For this error - Unresolved class 'InitializationProvider'
Add To use Jetpack Startup in your library or app, add the following to your Gradle file:
dependencies {
implementation("androidx.startup:startup-runtime:1.1.1")
}
Add code in 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.example.my"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="25"
android:targetSdkVersion="33" />
<permission
android:name="com.example.my.DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION"
android:protectionLevel="signature" />
<uses-permission android:name="com.example.my.DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION" />
<application
android:allowBackup="true"
android:appComponentFactory="androidx.core.app.CoreComponentFactory"
android:dataExtractionRules="#xml/data_extraction_rules"
android:debuggable="true"
android:extractNativeLibs="false"
android:fullBackupContent="#xml/backup_rules"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/Theme.My" >
<activity
android:name="com.example.my.MainActivity"
android:exported="true" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<provider
android:name="androidx.startup.InitializationProvider"
android:authorities="com.example.my.androidx-startup"
android:exported="false"
tools:node="merge">
<meta-data
android:name="androidx.emoji2.text.EmojiCompatInitializer"
android:value="androidx.startup"
tools:node="remove"/>
<meta-data
android:name="androidx.lifecycle.ProcessLifecycleInitializer"
android:value="androidx.startup"
tools:node="remove"/>
</provider>
</application>
</manifest>

Android Studio Does not find the InitializationProvider name class.
You can add this dependency.
implementation "androidx.startup:startup-runtime:1.0.0"
and change your manifest like this
<provider
android:name="androidx.startup.InitializationProvider"
android:authorities="${applicationId}.androidx-startup"
tools:node="remove" />

Related

AndroidManifest.xml - No resource identifier found for attribute 'launchmode' in package 'android'

I am trying to use a single instance of an activity when NFC is triggered. Adding android:launchmode="singleTask" should do the trick, but I get an error when I configure the launch mode:
Attribute android:launchmode is not allowed here
AndroidManifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="packageName"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="17"
android:targetSdkVersion="23" />
<uses-permission android:name="android.permission.NFC" />
<uses-feature
android:name="android.hardware.nfc"
android:required="false" />
<application
android:allowBackup="true"
android:label="#string/app_name"
android:supportsRtl="true" >
<activity
android:name=".NFCReader"
android:label="#string/app_name"
android:launchmode="singleTask" >
<intent-filter>
<action android:name="android.nfc.action.TECH_DISCOVERED" />
</intent-filter>
<meta-data
android:name="android.nfc.action.TECH_DISCOVERED"
android:resource="#xml/nfc_tech_filter" />
</activity>
</application>
</manifest>
It is android:launchMode not android:launchmode.

Error:Execution failed for task ':app:processDebugManifest'.?

i don't know why this error arises suddenly it came in my stackrace
Error:Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed : Attribute meta-data#android.support.VERSION#value value=(25.3.1) from [com.android.support:design:25.3.1] AndroidManifest.xml:27:9-31
is also present at [com.android.support:recyclerview-v7:26.0.0-alpha1] AndroidManifest.xml:24:9-38 value=(26.0.0-alpha1).
Suggestion: add 'tools:replace="android:value"' to <meta-data> element at AndroidManifest.xml:25:5-27:34 to override.
Manifest file:
this is my manifest file, i had updated my android studio 2.3.2 recently.
<?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.shopkart.theinvincible.shopkart">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<application
android:allowBackup="true"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity
android:name=".MainActivity"
android:label="#string/app_name"
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>
</application>
</manifest>
There is a version conflict in with the support library you used and the support version defined in your merged manifest file. You should add <meta-data> tag in your manifest file as shown below in order to override the conflict.(This is clearly mentioned in suggestion along with error log, see it)
<?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.shopkart.theinvincible.shopkart">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<application
android:allowBackup="true"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<meta-data tools:replace="android:value"/>
<activity
android:name=".MainActivity"
android:label="#string/app_name"
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>
</application>
</manifest>
the Manifests have different SDK Versions and cannot be merged
you needed to edit Manifests.this may help you
use this below code or go back to the older version to continue your project.
<?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.shopkart.theinvincible.shopkart">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<application
android:allowBackup="true"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<meta-data tools:replace="android:value"/>
<activity
android:name=".MainActivity"
android:label="#string/app_name"
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>
</application>
</manifest>

Android App Manifest merger failed Facebook and Firebase

I'm working on a social app (Facebook and Firebase).
Once I added the firebase gradle path, I got this error:
Error:Execution failed for task ':app:processDebugManifest'.
Manifest merger failed : Attribute activity#com.facebook.FacebookActivity#theme value=(#android:style/Theme.Translucent.NoTitleBar) from AndroidManifest.xml:85:13-72
is also present at [com.firebaseui:firebase-ui-auth:0.6.0] AndroidManifest.xml:69:13-58 value=(#style/FirebaseUI.Translucent).
Suggestion: add 'tools:replace="android:theme"' to element at AndroidManifest.xml:81:9-85:75 to override.
build.gradle file:
compile 'com.firebaseui:firebase-ui:0.6.0'
compile 'com.facebook.android:facebook-android-sdk:4.0.0'
Mainfest 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.friendture.apps.android.friendture">
<uses-permission android:name="android.permission.SEND_SMS" />
<uses-permission android:name="android.permission.RECEIVE_SMS" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<application
android:name=".Init"
android:allowBackup="true"
tools:replace="android:theme"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="*****" />
<meta-data
android:name="com.facebook.sdk.ApplicationId"
android:value="******" />
<activity android:name=".Activity.SplashScreenActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".Activity.ProfileActivity"
android:label="#string/title_activity_profile" />
<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=".Activity.PasswordActivity" />
<activity android:name=".Activity.SelectFromListActivity" />
<activity android:name=".Activity.CompleteFacebookActivity"></activity>
</application>
Ever since we added firebase-ui-auth to our project, this error has shown up and if it's not properly fixed, causes facebook activity to crash !
To fix it, update the manifest (notice the new "tools" attribute):
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="YOUR_PACKAGE">
<!-- Facebook API Key -->
<meta-data
tools:replace="android:value"
android:name="com.facebook.sdk.ApplicationId"
android:value="#string/facebook_app_id" />
<activity
android:name="com.facebook.FacebookActivity"
android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
android:label="#string/app_name"
android:launchMode="singleInstance"
android:screenOrientation="portrait"/>
The combination of two earlier answers by Nayan Srivastava and MhmdAljobairi worked for me:
<meta-data
android:name="com.facebook.sdk.ApplicationId"
tools:replace="android:value"
android:value="#string/facebook_app_id"
/>
As hint is already there in logcat response, just add 'tools:replace="android:theme"' to your application node in manifest and you are good to go.

Adding meta tag in manifest.xml file for admob

I am trying to add meta tag to add admob to my application but it is giving me error.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.deepak.indoreinfo"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="9"
android:targetSdkVersion="14" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<meta-data android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version"/>
<activity
android:name="com.deepak.indoreinfo.MainActivity"
android:configChanges="orientation"
android:label="#string/app_name"
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.google.android.gms.ads.AdActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />
</application>
</manifest>
It is giving me error No resources found that matches the given name (at 'value' with value '#integer/google_play_services_version') but this value is available in library project

Android StackWidget unable to bind

I am currently trying to add a widget to my application and have been basing my implementation on this code http://developer.android.com/resources/samples/StackWidget/index.html
I have put all my stack widget related classes in their own package within my main package.
When I try to add the widget it is unable to bind and hence the cards are not displayed (it just states the default text "This is the empty view")
Below is my manifest.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.bencallis.dealpad" android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="11" android:targetSdkVersion="14" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application android:icon="#drawable/ic_launcher"
android:logo="#drawable/logo" android:theme="#style/DealPadTheme"
android:hardwareAccelerated="true" android:uiOptions="splitActionBarWhenNarrow">
<activity android:label="#string/app_name" android:name=".DealPadActivity"
android:configChanges="keyboardHidden|orientation|screenSize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".SettingsActivity" />
<activity android:name="com.google.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />
<!-- Widgets -->
<receiver android:name=".stackwidget.StackWidgetProvider">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<meta-data android:name="android.appwidget.provider"
android:resource="#xml/stackwidgetinfo" />
</receiver>
<service android:name="stackwidget.StackWidgetService"
android:permission="android.permission.BIND_REMOTEVIEWS"
android:exported="false" />
</application>
</manifest>
Error message:
E/RemoteViewsAdapterServiceConnection(474): bind(): Unknown component ComponentInfo{com.bencallis.dealpad/com.bencallis.dealpad.stackwidget.StackWidgetService}
I am sure there is a simple mistake somewhere which is making the component info repeat com.bencallis.dealpad.
Any ideas?
It turned out it was to do with my manifest and a problem locating the service. I was missing a . in the name (which gives it the path).
Silly mistake!

Categories

Resources