Split lib_main was defined multiple times - android

Split lib_main was defined multiple times
In "com.android.tools.build:gradle:2.0.0-alpha3" build success,
But the errors that occur in the "com.android.tools.build:gradle:2.0.0-alpha5".
finally instant run work!! com.android.tools.build:gradle:2.0.0-alpha8 and gradle.properties "org.gradle.jvmargs = -Xmx8g" was resolved to change.

Just delete build folder of appmodule and Rebuild the project!
This will fix the issue!.

For those who wonder what InstantRun is (first setting in the picture):
And yes disabling that setting fixes the issue.
Edit 01/19/16
'com.android.tools.build:gradle:2.0.0-alpha6' was released three days ago. Using that new version, the "Split lib_main was defined multiple times" error is gone and installation of the app succeeds but now I get a runtime error:
java.lang.RuntimeException: Unable to instantiate application
com.android.tools.fd.runtime.BootstrapApplication:
java.lang.ClassNotFoundException: Didn't find class
"com.android.tools.fd.runtime.BootstrapApplication" on path:
DexPathList[[zip file "/data/app/com.onegravity.k10.pro2-2/base.apk",
zip file "/data/app/com.onegravity.k10.pro2-/split_lib_main.apk"]
Caused by: java.lang.ClassNotFoundException: Didn't find class
"com.android.tools.fd.runtime.BootstrapApplication" on path:
DexPathList[[zip file "/data/app/com.onegravity.k10.pro2-2/base.apk",
zip file "/data/app/com.onegravity.k10.pro2-2/split_lib_main.apk"]
Suppressed: java.io.IOException: No original dex files found for dex location
/data/app/com.onegravity.k10.pro2-2/base.apk
Suppressed: java.lang.ClassNotFoundException:
com.android.tools.fd.runtime.BootstrapApplication
Turning off instant run eliminates that error.
Let's wait for com.android.tools.build:gradle:2.0.0-alpha7...
Edit 01/25/16
'com.android.tools.build:gradle:2.0.0-alpha7' was released two days ago.
Getting the same exception as with 2.0.0-alpha6

I ran into this issue after refactoring and changing app name in gradle. Following AskQ's lead, I rebuilt the project (following a slightly different path):
Build-> Clean Project
followed by
Build-> Rebuild Project
Solved the issue

Recovery:
Deleting the (projectFolder)/app/build folder and re-building worked for me. (as answered by #AskQ)
I wonder if Build > Clean Project would have worked as well; from the Android Studio GUI menus.
Avoidance:
In my case the problem seems to have occurred because I had copy pasted a project, so 2 projects had the same name.
There are like other causes too, learning what they are can help users avoid this concern.

It might happen because of your package name is in uppercase, so you must change it back to lowercase.

Android studio 2.3.3
It worked for me after disabling Instant run in settings...
Go to Settings-> Build,Execution and Development-> Instant Run -> Uncheck
Enable Instant Run to hotswap then clean project and Rebuild your project again!!

Related

Android Studio gradle does not see file in currect project folder on Windows

I faced with interesting problem in one of my Android projects in Windows.
My project folder is D://workspace/project.
In gradle file in this project I have the following line:
java.nio.file.Path f = Paths.get('build/some_file_name.dat')
f.write ...
And this file definitely exists. But I can not compile project because of this error:
Caused by: java.nio.file.NoSuchFileException: build\some_file_name.dat
If I change file path to full path:
java.nio.file.Path f = Paths.get('D://workspace/project/build/some_file_name.dat')
f.write ...
it will work correctly, project will be compiled successfully. But I think this is not the best solution and also I need to disable commit changes from this file during every commit, it is not good.
I think, there must be a way to make gradle understand where is file in project folder only by this way: "build/some_file_name.dat".
And also I have noticed, this problem happens only in Windows, in Mac all is okay with it.
Does someone know, how to solve this problem?
The file you are searching "build/some_file_name.dat" is not in the directory where your project is. try to give the accurate path. or make sure you file name doesn't contains any spaces or special character.

update failed java.io.FileNotFoundException

i updated my ide to letest version after update i opend project on which i was working before update but it gave error but when i opend other projects there had no error
please help Thank you
update failed for AnAction(com.intellij.execution.ExecutorRegistryImpl$ExecutorAction) with ID=Run
java.io.FileNotFoundException: E:\Android\WhatsApp\app\build\intermediates\apk_ide_redirect_file\debug\..\..\apk\debug\output-metadata.json (The system cannot find the file specified)
at java.base/java.io.FileInputStream.open0(Native Method)
at java.base/java.io.FileInputStream.open(FileInputStream.java:219)
at java.base/java.io.FileInputStream.<init>(FileInputStream.java:157)
at java.base/java.io.FileReader.<init>(FileReader.java:75)
just clean project and make a build
It is solved by just rebuild project
Build → Rebuild project
Workaround: if you encounter this error generating an APK, first clean the project (Build -> Clean project)
Open your project.
If your project files are not loaded and instead you see: 'Loading...' cancel Sync Gradle by clicking on X at the bottom, this should show your files back.
Clean Project: Build -> Clean Project
Rebuild Project: Build -> Rebuild Project
In my case, I was unable to Clean Project as well as Sync Gradle Files, So
Eventually I was about to give up, but then I went to
AndroidStudioProjects/project_name/app/build/intermediates/apk_ide_redirect_file/debug in the file explorer and found a file named redirect
That file contained the following information
#- File Locator -
listingFile=../../apk/debug/output-metadata.json
From here, I tried to locate the path mentioned in this file and I was unable to find itSo I searched output-metadata in the file explorer from AndroidStudioProjects/project_name and I found a bunch of output-metadata files, I copied the first one and pasted it in the mentioned location, and then everything worked perfectly
Now I don't know wether this is the right way to solve this or not, but it worked...
Hope it helps you...

How to copy projects in Android Studio?

I tried copying my Android Studio project but every time I do that it gives me errors. I read other questions and answers on this topics but none of this helped me.
When I copy a project and try to run it on the emulator it gives the following error:
"Installation failed with message Invalid File:
C:...\app\build\intermediates\split-apk\debug\slices\slice_9.apk. It
is possible that this issue is resolved by uninstalling an existing
version of the apk if it is present, and then re-installing."
According to answers on similar questions, it should help to perform a 'clean project'. When I do this, the emulator starts but stops starting the app with a runtime error:
"java.lang.RuntimeException: Unable to instantiate activity
ComponentInfo{nl.assortimens.hardlooptrainingapp/nl.assortimens.hardlooptrainingapp.MainMenuActivity}:
java.lang.ClassNotFoundException: Didn't find class
"nl.assortimens.hardlooptrainingapp.MainMenuActivity" on path:
DexPathList[[zip file
"/data/app/nl.assortimens.hardlooptrainingapp-1/base.apk"],nativeLibraryDirectories=[/data/app/nl.assortimens.hardlooptrainingapp-1/lib/x86,
/vendor/lib, /system/lib]]"
How can I copy projects without errors or what should I do to fix those errors?
try to delete the intermediates folder and rebuild the project, if not delete the build folder and rebuild again
go to run-> rebuild project and should work correct
Try to remove the build.gradle file, and settings.gradle file. Then rebuild. Hope this gives your problem.

Eclipse - Several Errors After Altering Proguard and Manifest Files

I have an Android project for which I use the Eclipse IDE and I wanted to try an use the ProGuard tool to obfuscate/shrink my code. Unfortunately I couldn't get it to work with Eclipse throwing up a ProGuard error when I try to export my project.
To resolve this I altered the necessary project properties file to NOT use ProGuard but Eclipse just complained there were errors with the project which needed to be resolved. I tried cleaning the project, refreshing too but all to no avail. As I use a Mercurial for source control I reverted to my last good sources but now Eclipse throws up even more errors which I cannot get rid of:
org.eclipse.core.internal.resources.ResourceException: Resource is out
of sync with the file system: '/XXXXX/AndroidManifest.xml'.
loadAndParseRClass: failed to find manifest package for project
XXXXXXX
I've never been a great fan of Eclipse but how can I clean my project and get it back to a NON proguard state?
I resolved the problem. There's ANOTHER error log in Eclipse called 'Problems' which tells me my Debug certificate has expired on 25/12/2011. Handy how Eclipse labels this as a 'problem' and not an error and gives no indocation other that a red x that there's some sort of problem!
Anyway I resolved this by going here.
Make sure you Refresh your project so that the state of your Workspace/IDE agrees with your state on disk (Right click on the project and select "Refresh"). This will get rid of the first error you have.
And then just do a Team -> Revert on your projects and select the files that you have changed and want to revert to the checked-in version.

Unable to run HelloAndroid tutorial (or any project)

I have a problem where Android projects I create in Eclipse are unable to run/debug.
In the Package Explorer, there is the small red cross in the top Project Folder which signifies an error somewhere, but there are none in the lower level files of the Package Explorer.
When creating the project, an event appears in the Error Log stating: "Failed to load properties file for project 'HelloAndroid'"
I have tried:
Looking elsewhere in forum at similar issues
Reinstalling Eclipse, JDK, SDK, ADT
"Cleaning" the project
The error remains.
What could have caused this problem and what is the solution?
Thanks
try to see the problem... open the problem tab. Window > Show View > Problems
paste here, maybe I can help you better with more information
regards
Go to “C:\Documents and Settings\.android” OR “C:\Documents
and Settings\\Local Settings\Application Data\Android” and
delete debug.keystore file. (Linux: $HOME/.android)
Recompile the project and the error should be gone.

Categories

Resources