Android Gradle plugin 3.0.0 update issue - android

After I've updated android project gradle version to 3.0.0 I've faced weird issue. When I'm trying to install my app with Fabric or send *.apk via email it says "App cant be installed" but when I work directly with IDE everything is fine.
I've already spent a lots of hours browsing all known gradle 3.0.0 issues, but didn found anything.
Maybe anybody faced similar issue?
P.S. sorry, there is no match code to share, because I think its not related on configurations, cause it works via Android Studio.

Maybe anybody faced similar issue?
Yes, and I blogged about it a couple of days ago.
If you are going to distribute the APK, build the APK explicitly for that role, such as:
Using the “Build APK(s)” menu option
Using the assembleDebug or assembleRelease Gradle tasks
The APK from an IDE build now has FLAG_TEST_ONLY set, and such an APK cannot be installed normally. adb install -t will install it, but that would require the recipient to have the Android SDK.

Adding to CommonsWare answer, there is one more issue.
You might enabled Instant Run. One major drawback of this feature is, you can not use apk for other device (other than the device which you are using for development).
If so, after disabling this feature you will be able to use created apk (debug apk) to other device also (by using unknown sources option or adb option)

Related

No Compatible APKs found for the device

I was testing the new version of Ionic framework with Capacitor as I tried to build and run my app on emulator and my device I faced this error without success in installing app
No Compatible APKs found for the device.
after lots of search and struggling to fix this and lots of fails, as I was talking to one of my friends about it I realised maybe this is related to build configuration.
as I could not find similar anywhere I decided to share the answer here maybe helps and save someone time.
No Compatible APKs found for the device.
This error appears to your Build Output when android studio cannot find the related APK file generated, so by a simple change in your buid configuration you can fix this, in my case I fixed the problem like this:
thorugh this section select:
Edit Configuration
default Deploy option under Installation option is set to
APK from app bundle
by changing it to
Default APK
you'll be able to build and run your app successfully.
I hope it help you to run your shiny app asap ;p

Android Studio : The application could not be installed: SHELL_UNRESPONSIVE

i'm trying to install my app debug from my android studio. it's work well yesterday, but today when i try to install it again, the application cant be installed on my device and showing error like below on my android studio.
Installation did not succeed.
The application could not be installed: SHELL_UNRESPONSIVE
The device timed out while trying to install the application.
Retry
what should i do? i tried install on other device, and it worked fine. My device is Redmi 4X and other device is Samsung J3
Faced the same issue, not sure of the reason but in Android studio, Click on the File -> Invalidate Caches/ Restart and then it starts to work.
I got same issue with my device. i restart my device and its work properly.
The problem is because you don't have the proper SDK for the Android version. I'm telling you because a month has passed for me too. The solution is to download the appropriate pack in the SDK Manager.
If you have doubts how to enter:
Close the project.
In the welcome panel click on settings, then choose the SDK Manager option.
Click show package details and select the version for Android and choose all packages.
Finally you click ok XD
Try this method if it works perfect greetings
If other answers didn't help and previously application was installing correctly on your device, try to check your AndroidManifest file. Check that nothing forbids to install your app because of os version conflict or manifest merging errors or other reasons.
I came across this problem recently, through process of elimination I determined the cause was related to dependencies in the build.gradle(your app name).
I suggest working backwards and comment out everything that was added since the last known working build/install.
In my case I have a legacy app developed back in 2016 being rewritten, dependencies for signalR have changed quite a bit since then, the original libs where causing the install to fail while everything else seemed excellent, not even a single build error was occurring. Commenting out the libs and references got the application to a runnable state.
In my case, I deleted the emulator and recreated it. It solved the issue.
Before this, I had already tried following which did not work for me:
From menu: File->Invalidate cache/restart.
Deleting .cxx, .idea, .gradle, build folders and rebuilding.
Cold boot device emulator
Posting this in case someone is trapped in my kind of situation.

Failure to install APK [INSTALL_FAILED_DEXOPT] Android Studio

I have tried literally everything to try and rectify this error when trying to deploy an app to an actual android device for debugging but have been unable to solve the matter. Everytime I try to launch I get a failed [INSTALL_FAILED_DEXOPT] error and when checking the logcat it is always because there is no classes.dex in my debug apk.
If I run gradlew.bat clean assembleDebug, there is no difference in the apk size so I'm assuming there is a build error in android studio. I am using android studio beta 0.86 and have tried it on 0.89 with the same result. I have tried build tools for 19.1 to 21 with no result. I have also tried different devices and created a new project (that has never been installed on my devices) and android studio seems to think it needs to be uninstalled first when attempting to deploy.
I have tried switching my device to ART, uninstalling and reinstalling android studio, redownloading the sdk and restarting my computer. NOTHING and I mean NOTHING has worked. I think the problem started after I downloaded the lollipop apis but am not sure. I have tried uninstalling all apps with my package signature on my device but NOTHING works! Not even Project -> Clean Project -> Rebuild
This is extremely frustrating as I cannot debug my apps anymore :/ has anyone had any experience with this error or ways to rectify it?
So turns out that the issue was mismatching sdks between Android Studio and the Project. The project was using an old sdk and once I made them the same, I cleaned and rebuilt the project and everything was good to go.
UPDATE:
I ran into the problem again after I tried to update my SDK and its tools. Turns out that when you try to do this, the SDK locks the tools folder and then you get an error saying some file couldn't be overridden. When this happened to me, all the build tools were deleted so there were errors in the .dex file created when debuggin my app.
We are using android 2.2 (really old i know) and couldn't find a fix for this error. Eventually we found this bug https://android-review.googlesource.com/#/c/30900/. The only solution for us was to remove some libraries...
I kept having the same problem - manually building worked fine, but Android Studio would not build a proper APK.
The problem was that I started the project on Android Studio and Android Gradle plugin version 2.0-beta2. After updating the Gradle plugin to 2.0-beta6 through a simple build.gradle change, the builds stopped working.
Turns out that, although I installed a beta version of Android Studio, the update checker only checked the stable channel. After setting the updater to check the canary channel as well, I was able to upgrade Android Studio to version 2.0-beta6 and builds continued to work normally.
You can change the update preference in Android Studio settings under Appearance and Behavior -> System Settings -> Updates.
I encountered this error when storage of the device is full. Try to open some space.
Try run these commands
adb reconnect
adb reconnect device

Gradle gets stuck at either 'build' or 'assembleDebug' when using the 64bit or 32bit version of Android Studio

The issue I've had over the past few months is that Android Studio would often get stuck on Gradle: build, as seen here. Android Studio itself would stay responsive but the build simply wouldn't progress. It also never generates any kind of error, so I can't really post any useful information. Once in a blue moon it might suddenly work, but nothing reliable.
Recently I found a post here on Stack Overflow where someone's Android Studio would get stuck on Gradle: build when he tried to create a new project, and he noticed that this issue didn't exist in the 32-bit version of Android. So I thought, why not try that. Turns out that building isn't an issue anymore, but assembleDebug is, when trying to build the application. As can be seen here.
Of course all these commands work flawlessly when run using command prompt and gradlew.
What I've tried so far:
Reinstalling Android Studio (including the removal of .AndroidStudioProject)
Upgrading Android Studio to the latest version
Removing any build files from projects
Creating completely new projects in Android Studio
Switching from 64-bit to 32-bit Android Studio
I'm running the latest version of Android Studio, using version 19.1.0 of the build tools, gradle v0.11+ and am on Windows 8.1.
Is there anything else I can try? This is starting to become seriously annoying. The last possible solution I can come up with is just doing a complete format and a fresh Windows installation.
I was experiencing the same problem, and the solution was very unexpected in my case: AVAST antivirus was somehow interfering with the Gradle:build process.
Deactivating this antivirus solved the problem!
Because there is no answer to this problem I will share, what I have done, to solve this issue. From what I have seen, the problem is that there is a dependancy(or many) from a maven repo that can not be loaded. So you have to take all dependacy one by one and check if exist on the maven repo.
For example I was having a dependancy for "org.jraf:android-switch-backport:1.3.1" from "http://JRAF.org/static/maven/2" that at that time could not be opened.
My build.gradle looked like this:
repositories {
mavenCentral()
maven {
url "http://JRAF.org/static/maven/2"
}
}
compile "org.jraf:android-switch-backport:1.3.1
For me, this problem occurred when I was USB tethering using an Android device. The first build took anywhere from 5-10 minutes, and every subsequent build took about 3-7 seconds. I found that by disabling USB tethering, the first build completed quickly (and so would all subsequent builds). After the first build completed, I could reenable USB tethering.
If you have a fresh Ubuntu 14.04 with Android Studio 1.5, you may be missing a library. Try this:
sudo apt-get install lib32z1
Another stack overflow answer
It happens 1 in 2 times for me. The hack that works for me is File->Exit and confirm exiting. Then a message shows up telling me that Gradle is running and then all of a sudden the screen to choose the device shows up. I Click NO and all goes well again.
Anyway, still a bummer, but I have not found an answer yet.
My problem was that the Android Sdk executables were missing the executable bit. You can check some of your binaries like /Sdk/build-tools//aapt to see if they have permission to execute. If not you can solve it by running this on the Sdk folder
chmod -R +x ./
If you are behind a proxy on ubunthu you might need to set your gradle system wide proxy:
sudo nano ~/.gradle/gradle.properties
And enter the following entries:
systemProp.http.proxyHost=<Your Host>
systemProp.http.proxyPort=<Your Host Port>

How to check phonegap/cordova build errors

This may be a silly question but here it goes:
I'm developing my first app with phonegap, and currently targeting android only. But this is the second time I face this problems, in my project folder, through CLI I run cordova build android, the apks were not generated.
After a LONG time debugging, and undoing my recent changes. I finally tried to compile it in Eclipse, to check if it was an android compilation error, just to find out that I have copied some test images, and the names got something copy (1).png, and android don't allow that name...
So, How do I check, from command line, the logs/errors generated by phonegap/cordova buid?
You can run the CLI in debug mode with the -d option.
cordova -d build android
This way you will get a lot more detailed report.
I'm sure you have this figured by now but just in case you, or anyone else still needs help, you may be encountering this issue because of your antivirus. I had a similar issue where when I tried to build my application. Though there were no errors being given, it was not building any APK's.
The fix for me in this situation was by temporarily disabling "Auto-Sandbox" in Comodo, (the antivirus I was using).
Hopefully this helps anyone having the same issue.

Categories

Resources