I follow the instructions to Copy the “GeoQuiz” Directory and renaming to “GeoQuiz Challenge”. Then File → New → Import Project and navigate and select “GeoQuiz Challenge”.
After I was in the GeoQuiz Challenge Project and I click the Green Arrow to Run the application in the emulator I get the below error and it does not run. The original GeoQuiz project still works fine. What am I doing wrong?
Installation failed with message Failed to finalize session : INSTALL_FAILED_INVALID_APK: Split lib_dependencies_apk was defined multiple times.
It is possible that this issue is resolved by uninstalling an existing version of the apk if it is present, and then re-installing.
WARNING: Uninstalling will remove the application data!
Do you want to uninstall the existing application?
SOLVED: Found Online…
STEPS FOR CREATING AN ANDROID STUDIO PROJECT FROM ANOTHER PROJECT
(Tested multiple times as of version 2.3.3)
Close Android Studio
Navigate to projects directory and find the project folder you wish to replace
Copy the project folder, paste in the same directory and rename (no spaces)
Open Android Studio, opening copied/new project
If prompted to remove Gradle import from the project, leave checked and click ok.
Under app, res, values, open strings.xml and update the app name. You will likely come back here to edit further strings to fit your new app.
In MainActivity.java, highlight the part of the package name that needs to be changed (usually the last part after the period, e. g. in the package net.androidbootcamp.concerttickets you would select concerttickets).
Right-click on selection and choose refactor, then rename.
When prompted to rename package or rename directory, first choose rename directory, leave comments checked and proceed.
Be patient until the bottom left corner says “[n] occurrences changed”.
Repeat steps 8-10, but this time choose rename package, then check both boxes (comments and text occurrences), and proceed.
It will give you a refactor preview at the bottom, click “Do Refactor”.
Click the synchronize button (Ctrl+Alt+Y).
Select build, clean project.
Use project search and replace to double check your package names. My experience has been without issue but this is just in case. After refactoring, you may also notice that the full package name now displays as a prefix for resources in the code, for example, “net.androidbootcamp.concerttickets.R.id…” instead of just “R.id…” Either is fine but this can be quickly remedied with search and replace, as needed, for readability. If you perform this step, select build and clean project, afterward.
Run app to test before modifying further.
NOTE: You may need to re-select your theme for your (internal) emulator or make other similar environment-specific changes.
I too faced this problem and I like to believe the solution can be much simpler than QBang’s, although I do appreciate him answering his own question
On Stackoverflow I found this thread: Installation failed to finalize session... Signatures are inconsistent - Android - Stack Overflow.
This error usually happens to me in Android Studio when I try to open a project that was moved from another path or location, also other circumstances might cause this, what works for me is:
- menu “Build” run “Clean Project”. 2) menu “Build” run “Rebuild Project”.
Then run app on device or emulator, and error goes away. I know the error has nothing to do with this but that’s what fixes it for me, try and let me know.
For me this worked like a charm. Hope it does for you as well!
Thank you MartijnKor. That was awesome.
Running app on device 3DS Emulator or emulator the error goes away.
This is one of the best articles for epf balance check