I just ported a project built in an earlier version of Flutter and Android studio to a new machine and updated software. When attempting to build my Android project in the emulator, I'm getting the following error...
What went wrong:
Execution failed for task ':app:processDebugManifest'.
Manifest merger failed : Attribute meta-data#android.support.VERSION#value value=(25.4.0) from [com.android.support:appcompat-v7: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 element at AndroidManifest.xml:26:9-28:38 to override.
This is what my Manifest looks like...
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.yourcompany.myfavkpopflutterexample"
xmlns:tools="http://schemas.android.com/tools"
>
<uses-sdk android:minSdkVersion="16" android:targetSdkVersion="21" />
<!-- The INTERNET permission is required for development. Specifically,
flutter needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
<uses-permission android:name="android.permission.INTERNET"/>
<!-- io.flutter.app.FlutterApplication is an android.app.Application that
calls FlutterMain.startInitialization(this); in its onCreate method.
In most cases you can leave this as-is, but you if you want to provide
additional functionality it is fine to subclass or reimplement
FlutterApplication and put your custom class here. -->
<application android:name="io.flutter.app.FlutterApplication" android:label="myfavkpopflutter_example" android:icon="#mipmap/ic_launcher">
<activity android:name=".MainActivity"
android:launchMode="singleTop"
android:theme="#android:style/Theme.Black.NoTitleBar"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
<meta-data
android:name="io.flutter.app.android.SplashScreenUntilFirstFrame"
tools:replace="android:value"
android:value="true" />
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>
I've added the suggested tools:replace="android:value" and I'm still getting same error. I've seen similar questions that was Android Studio only. I'm adding this to SO because I think it may be related to my Flutter build.
I have the same problem too.
I resolved the problem by applying the suggestion in error message.
Adding tools:replace="android:label"
in (\android\app\src\main\AndroidManifest.xml) add tools:replace="android:label" like this:
<application
tools:replace="android:label"
android:name="io.flutter.app.FlutterApplication"
android:label="flutterwp"
android:icon="#mipmap/ic_launcher">
and don't forget add tools like this:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.wp"
xmlns:tools="http://schemas.android.com/tools">
I had this issue too but I solved by this.
Go to project directory/build, then you will see google_sign_in, image_picker, firebase folder, or any installed dependencies. Delete them. Go back to the pubspec file, do the Packages get and Packages upgrade again.
The issue may be the image_picker folder, which deleting image_picker is good enough. If this is really the solved your issue, check out the manifest-merger-debug-report.txt, you will see the reason why.
Hope your issue is solved.
I had this issue when I was trying to add AWS Datastore to my Flutter project that already had Google MLKit for local OCR. Either Datastore or MLKit would work, but not both together.
What worked for me:
Adding the following to the app\src\main\AndroidManifest.xml
tools:replace="android:name"
with the following declaration in AndroidManifest -
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.ABC"
xmlns:tools="http://schemas.android.com/tools">
Related
There are already many items on this topic and i have read a lot of them but without any succes.
In my Merged Menifest the following error
Merging Errors:
Warning Package name 'android.support.graphics.drawable' used in: AndroidManifest.xml, AndroidManifest.xml.
animated-vector-drawable:28.0.0 manifest
Warning Package name 'androidx.versionedparcelable' used in: AndroidManifest.xml, AndroidManifest.xml.
support:versionedparcelable:28.0.0 manifest
Error: Attribute application#appComponentFactory value=(android.support.v4.app.CoreComponentFactory) from
AndroidManifest.xml:22:18-91 is also present at AndroidManifest.xml:24:18-86 value=(androidx.core.app.CoreComponentFactory).
Suggestion: add 'tools:replace="android:appComponentFactory"' to <application> element at AndroidManifest.xml:20:5-83:19 to override.
TripMemory.app main manifest (this file), line 21
Now the warning annoy me but lets leave them for now.
The error is the problem and i have no clue what the problem is.
It suggests to add a "tools:replace..." but when i do that i just get the next error and besides it feels like bypassing the issue and not solving it.
I also don't understand why i am getting error's I did not update studio and i was just fixing some layout things. not even error's just improvements.
It then first started with AndriodX messages. and then this. Maybe that's a clue for somebody.
my AndroidManifest.xml
<?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.nocompany.tripmemory">
<!-- location via GPS -->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<!-- needed to get photo's of the phone -->
<!--<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />-->
<!-- needed to use the camera and export -->
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<!-- needed to use the camera -->
<!--<uses-permission android:name="android.permission.CAMERA" />-->
<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/Default">
<activity
android:name=".MainActivity"
android:label="#string/app_name"
android:theme="#style/Default.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
....
Can anybody help me how to read this error and find the solution?
Update
as suggested by ommonsWare i added by build.gradle (app) file here
put it as an image so the colors are clear.
Just an update should anybody face the same.
In the end i have choosen to rebuild my app from scratch.
I luckely is a small app and that was a lot faster because i went from error to error to error.
In retrospect this problem also allowed me to restructure some things in the groundworks making the app beter.
I am working on updating Android Manifest configurations on my Flutter project. However, there is one recommended fix that I could not find in the libraries I have used in flutter. But upon analyzing the APK, I found it in the AndroidManifest.xml in the APK via APK Analyzer
Shown above is the config I have to update. A very simple update where I have to replace android:exported to false.
I need help in figuring out a way to actually update this manifest since I do not see any file even after looking through each manifest files of the packages I've included in my project that contains the code/config shown above.
Add this in manifest
<application
tools:replace="android:label"
android:name="io.flutter.app.FlutterApplication"
android:label="flutterwp"
android:icon="#mipmap/ic_launcher">
You can simply edit this AndroidManifest.xml file.
Use tools:replace attr.
Checkout following example from official docs:
In library
<activity android:name="com.example.ActivityOne"
android:theme="#oldtheme"
android:exported="false"
android:windowSoftInputMode="stateUnchanged" />
Your own implementation
<activity android:name="com.example.ActivityOne"
android:theme="#newtheme"
android:exported="true"
android:screenOrientation="portrait"
tools:replace="android:theme,android:exported"
I seem to be having a similar problem to a myriad of the community; however, I don't seem to have the same symptoms (or at the very least, my Google-fu is not allowing me to find it).
Long story short: The app is giving me java.lang.RuntimeException: Unable to instantiate activity.
From what I understand this can only be caused by improper order of loading libraries or by missing the file in the AndroidManifest.xml.
Here is my AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="net.alexanderlyons.livingpokedex">
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
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>
</application>
Here is a link to my repository for those wanting to build it themselves. If anyone can give me insight as to what might be wrong.
Note: This may be due to my .gitignore, as the last time I built, it was on my main tower. I am only running into this issue on a remote machine.
TL:DR - My MainActivity is not loading, it exists in the AndriodManifest.xml, and I am only using gradles to load files, not local jars.
Your problem can be caused by different things, but the most common of it is you having too many libraries loaded, with too many methods.
You should enable multidex in your app, here's the guide:
multidex
A quick tutorial:
Add "multiDexEnabled true" to your gradle config (under target sdk version, for example).
Add this to your dependencies:
dependencies {
compile 'com.android.support:multidex:1.0.0'
}
And make sure you application extends this:
<application
...
android:name="android.support.multidex.MultiDexApplication">
...
</application>
Either via code or via manifest.
Edit:
Test the project with the build tools 22, sd version 22 and target 22. Also, use the support libraries 22.+
Ok so I was going through a tutorial online, then when i tried to change my build.gradle file to compileSdkVersion 21 instead of 23 everything lost the plot and now all my previous projects etc are all showing errors.
In the AndroidManifest.xml the 2 http lines and all the android: are all red and the the activity opening tag has a red squiggly line under it also. I have zero idea what i have done wrong! Almost like internet has gone? Just a noob so i have no idea please help!
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/tools"
package="com.site.project" >
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
This answer extends #adelphus'.
A new app\build\intermediates\manifests\full\debug\AndroidManifest.xml would have listed these errors. Close and reopen the AndroidManifest.xml file from the project pane under app > manifests.
Hope this works for you.
You have duplicate schema definitions for the xmlns:android namespace in your manifest file - only one schema per namespace is allowed and I suspect the compiler is getting confused by the duplicate entry.
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/tools"
package="com.site.project" >
should be:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.site.project" >
The namespace schema definitions are important - they are used to define attribute prefixes. Because your duplicate entry is invalidating the android namespace, all attributes prefixed with android: will be wrong - this is why all the android: attributes have an error (red line) displayed.
Alternatively, just remove the tools namespace completely if you're not using any attributes with the tools: prefix in your manifest:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.site.project" >
you need download jdk here "https://www.oracle.com/technetwork/java/javase/downloads/index.html"
then go to File > Project Structure > here you config path jdk default C:\Program Files\Java\jdk-11.0.2 . Hope this works for you
I think you have two AndroidManifest.xml files to change it. Just rename the debug AndroidManifest.xml and that solution works for me.
Search for the AndroidManifest.xml file(s). on the project ParentPath. if there are multiple, keep one and delete the others.(usually find many other)
I am struggling with a build error when using Gradle with the Android-Tools Gradle plugin to compile a multi-project build. 2 of my projects fail to build with the error reported above.
Note that we have added additional elements to the Android manifest that we use. Essentially, our AndroidManifest.xml file looks like this:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.xxx.yyy.zzz"
android:versionCode="13"
android:versionName="1.2.3">
<uses-sdk
.../>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="com.xxx.yyy.CONFIGURATION"/>
<application
...>
<activity
...>
...
</activity>
<activity
...>
...
</activity>
</application>
<meta-data android:name="www" android:value="xxxx"/>
<meta-data android:name="xxx" android:value="yyyy"/>
<meta-data android:name="xxx" android:value="zzzz"/>
</manifest>
The error is being reported on the last 2 meta-data lines (at the bottom of the above example), where the android:name attributes are identical. My limited research has identified this to be valid XML. Unfortunately I have not been able to validate the schema as I understand that no schemas are published.
Extract from the build log:
:src:aaa:processDebugManifest
/xxx/aaa/src/main/AndroidManifest.xml:36:3 Error:
Element meta-data#xxx at AndroidManifest.xml:36:3 duplicated with element declared at AndroidManifest.xml:35:3
/xxx/aaa/src/main/AndroidManifest.xml/AndroidManifest.xml:0:0 Error:
Validation failed, exiting
:src:aaa:processDebugManifest FAILED
I have been using earlier versions of the Android-Tools Gradle Plugin with an identical Android manifest file and this has not caused an issue (last known working version 0.8).
Question: Can I add configuration to my build.gradle file to ignore this? Or would it be worthwhile raising as an issue on the Android-Tools repo?
Thanks