Error while installing apk in the android emulator - java

I have tried all the possible solution available on stackoverflow. But I am getting the same error again and again. Not sure from where it's coming from.
I followed this thread. And updated the build.gradle file to
splits {
abi {
enable true
reset()
include 'x86', 'x86_64', 'armeabi', 'armeabi-v7a', 'mips', 'mips64', 'arm64-v8a'
universalApk false
}
}
This is the error I am getting
Installation failed with message INSTALL_FAILED_NO_MATCHING_ABIS: Failed to extract native libraries, res=-113.
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?
Till yesterday night this was working fine. But today it's ruining my day. Could some one please help me with this ?
I am not using additional application like genymotion or arc welder. I am getting this error on android emulator.
I tried running it on real device, but same issue.
Regards

Can't believe this error happened because of an apache library. I recently added few apache dependency in my project and then this error starts appearing. The line I added
implementation 'org.apache.directory.studio:org.apache.commons.io:2.4'
And then after that struggling entire day. Finally I undo all my changes and find out this was happening because of the apache package.
I added this dependency in build.gradle and it works fine.
implementation group: 'commons-io', name: 'commons-io', version: '2.5'.
But not able to figured out how the apache packages interrupt emulator to work properly. Strange !
Posting this answer so that if someone could understand the reason behind the problem, please explain it to me as well :P

Related

Why doesn't Android Studio generate library classes for Dagger or DBFlow?

A few days ago I started to experience a weird problem with Android Studio. Every time I try to build my project I keep getting
for each class it should generate. I am using Dagger and DBFlow.
By scrolling all the Build Output logs I am getting
I tried to add the dependency manually like this
implementation group: 'javax.annotation', name: 'javax.annotation-api', version: '1.3.2'
but it keeps failing to build.
I also noticed that it keeps changing languageLevel="JDK_1_8" to languageLevel="JDK_11" in the misc.xml file even though I am using Java 8.
I also tried everything I found here from deleting the .idea folder to uninstalling Android Studio a few times unsuccessfully.
There were other errors in the logs. I had to scroll all of them and look for the one that caused the issue. Once it was fixed everything worked as planned.

Errors after updating to Anroid 3.6.1

Recently I updated my Android Studio into 3.6.1 without any problems occurring, but as soon as the Gradle finished syncing, an error message shows in my Build and Event Log.
(Inside the "Build" message)
org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ArtifactResolveException:
Could not resolve all artifacts for configuration ':classpath'.
org.gradle.internal.resolve.ModuleVersionResolveException: Could not
resolve org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.61.
org.gradle.internal.resolve.ModuleVersionResolveException: No cached
version of org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.61 available
for offline mode.
(inside the "Event log")
Gradle sync failed: No cached version of org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.61 available for offline mode.
I noticed that there's a "kotlin" (from the Event log) involved in the message, but I haven't used a single project with Kotlin yet.
I haven't seen any solutions that helped me so far, only saw old problems that were slightly the same as mine that's why I posted this question instead. Its the first time this error occurred to me, and also my first time asking a question.
Right now, I'm not able to run any of my projects in Android Studio because of this error. Please help!
-Thank you for answering in advance.
Check and disable the offline gradle and try again, Android Studio is muture enough to solve most of the problems now days. Try again after enabling the online gradle and click on sync again(eleghant icon with down arrow) to left of AVD icon in toolbar.
Try reinstalling android sdk maybe the problem is solved.

Execution failed for task ':app:javaCompileDebug'

I recently went back to an app in android studio that worked fine on Android Studio 2.3.3 but this morning when I was prompted to update to Studio 3.0 my module wont make. I have tried cleaning and rebuilding but when I try run it on my device the build fails and gives me this error:
Error:Execution failed for task ':app:javaPreCompileDebug'.
Annotation processors must be explicitly declared now. The following
dependencies on the compile classpath are found to contain annotation
processor. Please add them to the annotationProcessor configuration.
- androidannotations-4.0.0.jar (org.androidannotations:androidannotations:4.0.0)
Alternatively, set android.defaultConfig.javaCompileOptions.annotationProcessorOptions.includeCompileClasspath = true to continue with previous behavior. Note that this option is deprecated and will be removed in the future.
See https://developer.android.com/r/tools/annotation-processor-error-message.html for more details.
I have no clue about android annotations that is why I am asking here on SO.
Thanks!
After doing some research I was able to find this GitHub issue. This picture solved my problem!

Marked as an error code in Android Studio, but successfully build gradle and run on the device

i have problem with my code. My Code marked as an error code in Android Studio, but successfully build gradle and run on the device, like this :
current configure:
My current project uses a lot of libraries in dependencies. But if
the project with little library will not be marked errors like this.
Android Studio 1.5 RC1
compileSdkVersion 'Google Inc.:Google
APIs:23
buildToolsVersion '23.0.2'
classpath
'com.android.tools.build:gradle:1.3.1'
activity I have done but have not solved the problem:
always clean > re-build project
invalidate caches / restart > open Android studio > open this project
Close android studio > restart computer > open again android studio > open this project
Update Android version and SDK version
5.Uninstall Android Studio > Re-Install Android Studio > Open Project
edited: it's seems error each code from android support like recyclerview, CardView, APpCompact
this my depedencies
dependencies {
compile project(':android-crop')
compile project(':RTEditor-Toolbar')
compile files('libs/apache-mime4j-0.6.jar')
compile files('libs/httpmime-4.1.3.jar')
compile files('libs/jetbrains-annotations.jar')
compile files('libs/gcm.jar')
//three party library
compile('com.crashlytics.sdk.android:crashlytics:2.5.1#aar') {
transitive = true;
}
compile('cn.trinea.android.view.autoscrollviewpager:android-auto-scroll-view-pager:1.1.2') {
exclude module: 'support-v4'
}
compile 'com.google.android.gms:play-services:8.3.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.mcxiaoke.volley:library:1.0.19'
compile 'com.vinaysshenoy:mugen:1.0.1'
compile 'com.github.clans:fab:1.5.5'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.github.curioustechizen.android-ago:library:1.3.0'
compile 'com.jakewharton:butterknife:7.0.1'
compile 'com.github.chrisbanes.photoview:library:+'
compile 'com.subinkrishna:circularimageview:1.0.2'
compile 'me.leolin:ShortcutBadger:1.1.3#aar'
compile 'com.google.android.gms:play-services-ads:8.3.0'
compile 'com.google.android.gms:play-services-identity:8.3.0'
compile 'com.google.android.gms:play-services-gcm:8.3.0'
compile 'cn.trinea.android.common:trinea-android-common:4.2.15'
compile 'com.sothree.slidinguppanel:library:3.1.1'
compile 'com.android.support:multidex:1.0.1'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:cardview-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.android.support:recyclerview-v7:23.1.1'
compile 'com.android.support:support-v4:23.1.1'
}
so how fix ? thanks for advance
If your project builds in gradle, but Android Studio displays errors, chances are that the Intellij caches are corrupt. In some cases, the menu option you already mentioned "invalidate caches / restart" is not enough. You can try the following:
Shutdown AS
Manually delete the cache dir. On Windows, this is likely to be in a path like C:\Users\YOURNAME.AndroidStudio1.4\system\caches.
Restart AS
This is extremely common, and happens to me whenever I start my Android Studio up. Follow these steps after you have made sure that you have imported everything your code needs to import. If you are not sure how to do that, look at the very bottom of my answer, where it says More Issues that could be happening.
Here are some things that you can easily do to fix it:
Clean project
Rebuild Project
Restart IDE
Update SDK tools
This is probably not an issue with your code, so you don't have to worry about it much. If cleaning and rebuilding doesn't work, just wait for some time.
Give android studio a while to set up, and this could take a few minutes. Often times, it fixes itself without even having to do any of the steps I listed above. Make sure you do this before trying to update your SDK or messing with any files. If you do that, I suggest you take a backup first.
I suggest you take a look at this question:
"cannot resolve symbol R" in Android Studio
MORE ISSUES THAT COULD BE HAPPENING
Also, according to your screenshot, I saw a lot of errors in some of the same places. This could be because you are not importing the correct things! Click on one of the pieces of code that has a red squiggly line on it, and wait for a message. It should say something about imports. Then press ALT->ENTER. This should import what you need for that line of code to work.
None of the things mentioned earlier here did actually work for me But then I found this menu entry in the file menu Invalidate Caches/Restart which appears to have fixed the problem.
I don't really know what happened in the background but when Android Studio started up again the status bar said Indexing... for a minute or so which apparently did wonders.
if it still not working solution is very simple i have tried also
it was just go to help menu and check for update then restart android studio
as attached photo
Faced the same issue and struggled half day to resolve it.
Finally found the solution. If you're facing the situation where the project is building successfully, but Cannot resolve ThirdParty.class error is coming. Than do following steps:
Delete .idea folder from your project.
Close Android Studio
Restart Android Studio and Import your project.
And you're good to go.
Tried Almost everything like invalidate catche and restart,rebuild,update sdk tools,delete .idea folder etc. but you need to delete catches manually from C:\Users\YOURNAME.AndroidStudio1.4\system\caches.It should work.
Adding answer from Ruchir, all the new things is good but not really good for some.
I tried to re-create my environtment and found that newest AS have problem with newest SDK. So All I did was:
use AS 1.4.1 (stable)
downgrade SDK to use v23.0.1.
gradle.build changes as follows:
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support:cardview-v7:23.0.1'
compile 'com.android.support:design:23.0.1'
compile 'com.android.support:recyclerview-v7:23.0.1'
compile 'com.android.support:support-v4:23.0.1'
Then do the basics "clean up":
Clean project
Rebuild Project
Done. It's not your code, it's IDE. Consider submit error report to Google about this error.
I faced the same problem and I just followed the following procedure to fix:
1) Take the backup of your android project
2) Delete it from your android studio
3) Import it again
Finally I resolved that issue just by changing JDK:
Firstly right click on "Android Project", then go to "Module settings"
Select "SDK Location"
Uncheck "Use Embedded JDK" and browse to install "JDK" folder.
Rebuild your project and all your java errors related will gone.
The cause was just the embedded JDK.
I'm running into this quite a bit while in the process of moving code (and libraries) from one module of a project to another.Project compiles/runs, signed APK builds, but Android Studio editor insists it can't find classes.
In my particular scenario, the most effective solution I've found is to modify build.gradle within Android Studio such that the editor indicates:
Gradle files have changed, a Project Sync may be necessary.
Then clicking the Sync Now button. In my case, I've not actually had any reason to change the build.gradle file, so I tend to just make an arbitrary change to the file and then reverse it.
I got a similar problem after upgrading my PC and reinstalling Windows.
The only solution that worked for me was using jdk 7 instead of jdk 8.
I never run into this problem with my old machine and jdk 8.
I ran into the same problem many times, I tried many suggested things in StackOverflow, but I would like to share the following procedure:
1) Go to File --> Invalidate cache and restart (this worked for me most of the times)
2) Then go to Project --> App --> Right Click --> Open module settings and navigate in SDK Location, locate the java, save the settings and restart the Studio.
Hope this helped!
I tried most of these answers but it did not work for me, but following these steps did the magic:
Click on "File" at the top left corner
Click on "Repair IDE"
A popup will appear at the bottom right corner with 2 options [1]: https://i.stack.imgur.com/FtXuY.png
Click on "Rescan Project Indexes"
If it works then its good if not than continue onto the next step
Hopefully it will help

Unable to start Gradle deamon in fresh install of Android Studio 0.8.1

I wanted to start some Android app development with my friend recently. I've installed the latest Android Studio 0.8.1 and cloned github repo. Then, when I try to build the project using Gradle, it is failing with the message:
Caused by: org.gradle.api.GradleException: Unable to start the daemon process.
This problem might be caused by incorrect configuration of the daemon.
For example, an unrecognized jvm option is used.
Please refer to the user guide chapter on the daemon at http://gradle.org/docs/1.12/userguide/gradle_daemon.html
I am using Windows 8.1 64bit, JDK jdk1.7.0_60 64bit and gradle 1.12
I tried to:
- disable firewall and antivirus - didn't help
- download gradle manually, unzip and copy to .gradle in my home directory - didn't help
- when I open a blank new app I have same problem
- I moved the app to different directory as my user name contains 'ł' - same issue
Can anyone look at the log and try to help? This is the most annoying kind of issues developer can face - env is refusing to work and you can't code :(
<<< link to log >>>
Finally, after quite long fight last night, I have managed to run Android studio and build project with Gradle... and I hope it will stay so.
So, as #Eugen pointed out, this could be related to the fact that first installation of Android Studio was done for "only current user". Even I have uninstalled it and installed again it was still failing. Last night, I decided to uninstall it and also, manually, remove all remains of android stuff by simply deleting every directory with android, gradle etc. in its name ;)
I have also updated java to 7.65. and installed stand alone Gradle 2.0 and add it to PATH and check it is working.
After that, I done a clean install of android studio and open simple new MyApp project... and it works! Then I opened my other project - also working! I removed Gradle from PATH - still working.
I have no idea what was wrong... probably first installation of Android Studio was not completely correct. And unistalling it, didn't removed everything.
So, I have no clear answer for my issues, but I thought it could be helpful to describe the story. :)

Categories