In the newest version of ADT (version 20 preview 3), they say that it's possible to make the libraries' manifest file become mergeable with projects that use them:
Automatic merging of library project manifest files into the including
project's manifest. Enable with the manifestmerger.enabled property.
How and where do I use it? I can't see content assist helping with me on this anywhere.
Add the following line to your project.properties file of your application project.
manifestmerger.enabled=true
Introduced with Android SDK Tools, Revision 20 (June 2012):
https://developer.android.com/studio/releases/sdk-tools
Build System
* Added automatic merging of library project manifest files into the including project's manifest.
Enable this feature with the manifestmerger.enabled property.
If you want to merge android library project manifest and your current project manifest, you have to add manifestmerger.enabled=true in your project.properties file where you referred your library project. But, you should be confirmed some point like ADT version, Also Minimum and target SDK should be same as library project.
FYI:
manifestmerger.enabled=true won't merge the manifest files if you are using eclipse export signed App.
As noted here it seems to be a bug.
http://code.google.com/p/android/issues/detail?id=34623
It was a bit of a hassle for me to set up merging correctly as well. (restarting eclipse, open close project..) To find out if merging is working take a look at the file in ../Your_Main_Project/bin/AndroidManifest.xml. If merging worked you will see the complete result in this file.
EDIT: This bug was fixed in ADT v20.0.1 (Juli 2012): http://developer.android.com/tools/sdk/eclipse-adt.html
I was facing some errors during manifest merging (R.java file went missing) so alternately I explicitly copied the manifest contents (e.g. I copied just the activity contents) from the library project manifest and put them in my main project manifest. That resolved the error and everything seems to be working well so far. Let me know if anyone feels this is not a recommended alternative to manifest merging.
Related
I am trying to create an android build from unity game. The build worked fine on Unity 5.5. Ever since I upgraded to 2017.2, the build fails and gives me error that its unable to merge android manifest files due to some conflict with a plugin manifest.
Following are the things I have tried
Deleting either of the manifest files and build
Deleting both the manifest files and build
Remove conflicting nodes in xml and build
Change value of conflicting nodes in xml to the same value
Every time I build, the files get written by conflicted values and it fails to build. Anyone good with unity android build, please suggest a solution.
It is most likely because the two android manifest files conflict with each other. For example, a few weeks ago I got the same error when my minimum android API was 22 for one file and 24 for the other. So I would suggest comparing the two files line by line and looking for conflicting pieces of information. This may not work but it's worth trying anyway.
Open all manifest files and check
“minSdkVersion” and “targetSdkVersion”
All manifest should have same values of these variables
when I build the game in Unity3D ,
it makes error :"plugins colliding with each other"
I am using Facebook SDK and Playfab.com SDK
Found plugins with same names and architectures,
Assets/Plugins/Android/libs/android-support-v4.jar (ARMv7) and
Assets/Plugins/Android/android-support-v4.jar (ARMv7). Assign
different architectures or delete the duplicate.
UnityEditor.AndroidPluginImporterExtension:CheckFileCollisions(String)
UnityEditorInternal.PluginsHelper:CheckFileCollisions(BuildTarget) (at
C:/buildslave/unity/build/Editor/Mono/Plugins/PluginsHelper.cs:25)
UnityEditor.HostView:OnGUI()
I tried to remove this file : Assets/Plugins/Android/libs/android-support-v4.jar
but I got another error
Error: [Temp\StagingArea\AndroidManifest-main.xml:3, D:\work\Apes
Shelter\Temp\StagingArea\android-libraries\facebook-android-sdk-4.7.0\AndroidManifest.xml:3]
Main manifest has but library
uses minSdkVersion='15'
any help will be appreciated :)
Check Minimum API Level in 'Build Settings/Other Settings'.
Here is someone with the same problem. Just set Minimum API Level to 15.
PROBLEM WHEN BUILDING ANDROID AND FACEBOOK SDK
this happens because 2 things:
1.Facebook SDK include files already contained in Assest/plugins/android, and
AndroidManifest.xml has to be updated.
so I did this:
Open AndroidManifest.xml (Assest/plugins/android/AndroidManifest.xml) with Xcode or Text edit and change line to this:
uses-sdk android:minSdkVersion="15" android:targetSdkVersion="23"
READ the error, it will tell you the values needed.
Assest/plugins/android/libs (NOT FacebookSDK/plugins/android/libs ) select All files, and in inspector deselect "android". (some people suggest to delete them, but i just deselect them so when the project builds they won't be included).
in finder look for .jar files duplicates and delete the ones that are in plugins/android Not the ones in Facebook
this was my case, maybe your is different, what I did was to look for duplicate files in Facebook SDK and Assest/plugins/android!
I have a problem importing the PagerSlidingTabStrip library into Eclipse, I get multiple errors and I know this happens because the library was built using gradle.
I tried to follow this answer but I can't find use as source folder in the build path menu.
I've never used gradle previously and don't know how to go about this in Eclipse. Please guys, help most of us who have this problem out of our dilemma. Would be very grateful.
Okay in the end this was what i did:
I checked the build.gradle file of the library for target and min sdks. I then put what i found in the android manifest.xml which I know Eclipse uses.
I deleted the build.gradle and gradle.properties files.
Made sure the project was marked as a library. And it works!
I think the most crucial step was to check the build.gradle for the sdks and whatever else the project requires and replicating that the way it should be in the manifest file.
I've updated to the new adt&sdk 20, and I'm having problems with the new way Proguard is being used on Eclipse. I'm not a pro with Proguard at all, yet I've always used it and it worked quite easily. I simply edited the "project.properties" file and added there "proguard.config=proguard.cfg", and it worked.
Sadly, some changes were made that I can't find any information of how to work with them. The official website that talks about Proguard (in the Android website) still talks about the older way.
They wrote on the "project.properties" to uncomment the next line:
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
This didn't work, it gives me these errors when trying to export:
Proguard returned with error code 1. See console
java.io.IOException: The output jar is empty. Did you specify the proper '-keep' options?
at proguard.shrink.Shrinker.execute(Shrinker.java:159)
at proguard.ProGuard.shrink(ProGuard.java:275)
at proguard.ProGuard.execute(ProGuard.java:101)
at proguard.ProGuard.main(ProGuard.java:492)
Can anyone help me with this? I never had to change the proguard.cfg file before and all was quite automatic. It was very rare that i had to do such a thing.
They also added a file "proguard-project.txt" which probably replaces the proguard.cfg and "extends" from the sdk folder's file, so i wonder: will it be ok to somehow reference to the file in the project instead (and put into the file the content of the "parent" file)? If so, how do I do that?
If it was working fine before and you haven't learnt Proguard, just change this line:
proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
to this line:
proguard.config=proguard.cfg
then you'll have your old Proguard setup back, I'd recommend updating though, it should just work unless your using some 3rd party jars? These are what is it saying is missing and you should use the -keep flag to stop Proguard from removing them when it obfuscates.
Ok , the solution is that for some reason , I had the wrong location set for sdk.dir variable on eclipse.
So what I did is to:
Go to eclipse's preferences
Searched for variables
And went to java->build path->classpath variables
And added "sdk.dir" variable with the value of the directory of
android sdk .
create a file proguard.cfg in your project root folder and update your adt to 21 and use proguard v4.8 or 4.9 and dont forget to run Android Lint before exporting APK
The path of default config file has been changed to
${sdk.dir}/tools/proguard/proguard-android-optimize.txt
Using SDK 22, my solution was to copy proguard-project.txt from ${sdk.dir}/tools/proguard/ into my project workspace.
If you look at project.properties, you see that it references ${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt.
It found ${sdk.dir} just fine, but was looking for proguard-project.txt in the project directory.
I made library for my android games and i wanted to add it to another project to test how it works, but when i ran the application, it does not seemed to be able to find my library files(INSTALL_FAILED_MISSING_SHARED_LIBRARY). I have my library .jar in "libs" folder and i also have it added to my Libraries and Order and Export tabs in build path. In my manifest, i have tag. I have Eclipse with ADT. Is there any way to fix this?
Are you using Google Maps in your application? If so, this may solve your problem: INSTALL_FAILED_MISSING_SHARED_LIBRARY error in Android
You wrote:
In my manifest, i have tag
If you are adding custom uses-library tags, that might be your problem. See: Installation error: INSTALL_FAILED_MISSING_SHARED_LIBRARY