Nithis
Nithis

Reputation: 33

Android studio gradle build running for too long time for build apk

  1. New Project.
  2. Imported all libs using gradle build system.
  3. Gradle build successful.
  4. Enabled gradle offline work and instant run.
  5. Attached my device, clicked run. App build competed in 4 mins.
  6. After few changes in code I clicked apply changes.
  7. App runs perfectly on device which I previously build, but when I extract the installed app(debug keys) it doesn't install on other device or same device (package currept).
  8. I clicked build apk(debug) in Android studio but gradle build running forever.

Please help me friends. There is no error in code. When I use Instant Run app opens perfectly on device but I cannot extract that apk to test on other device.

Upvotes: 3

Views: 4414

Answers (2)

Nithis
Nithis

Reputation: 33

To Fix this Issue no need to enable gradle online mode. I just cleaned Project and done rebuild. Then restarted Android studio. Now it's build apk very fast. It's recommend to enable gradle offline mode (not for initial build and when importing new libs)

Upvotes: -1

ישו אוהב אותך
ישו אוהב אותך

Reputation: 29783

You need to disable Instant Run first, because debug apk built with Instant Run will not run on phone with different api level from your test device.

Then you need to clean up and build the apk. If building apk seems like forever, make sure your internet connection is up.

Upvotes: 5

Related Questions