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.
Related
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...
I have imported the project from github and I am getting this error repeatedly. I can open my previous projects and run them on my phone but I can't do the same with this project. The "Gradle Build Running" runs forever. I have read through the answers regarding the same and I couldn't find anything useful.
android.R is the wrong import.
You should import com.example.android.miwok.R.
If that cannot be resolved, then R.java is not being generated.
Possible options
You need to build your project in order to generate that file.
You have some error elsewhere (usually in a XML resource file).
The "Gradle Build Running" runs forever.
A slow internet will cause this. When you first start a project, all the dependencies and Gradle binaries for the project need to be downloaded.
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!!
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.
When i run my project its give me below error.
Compile Error: Error generating final archive: java.io.FileNotFoundException: ..\bin\resources.ap_ does not exist.
I tried to clean my project but also it can not generate the resource.ap_ file and my apk file size is 0..
please help me to solve this problem...
Quite often problems like this can be solved by deleting the project from your eclipse workspace (NOT deleting the project files) then importing the project back into the workspace. Give it a try...
Usually the following steps work:
ADT -> Project -> Clean