4

First up, I'm totally new to the Android ecosystem and mobile app dev in general. However I am a veteran C#/C++/JS/Java app and web dev. So currently my corporate firewall has rules to prevent our work PCs from connecting online. I'm supposed to be doing android app dev fully offline. I got Android Studio installed and created a test app, however gradle refuses to build offline, even with the "Offline work" option ticked. If I build an app on my internet-connected laptop all goes fine. If I copy that app to my work PC, gradle crashes with "cannot find module XYZ in gradle cache". I tried copying over the<user>/.gradle/caches/ dir from my laptop to my PC but that doesn't work either.

So, I'm left with no option but to attempt to build my android project without gradle. I'd like to use the Android Studio IDE if possible, else I'd fallback to SublimeText. So my question is, how do I build, debug and emulate android apps without gradle?

Things I've tried:

  • Creating a hello world app on my laptop, building it and emulating it. Gradle updates all its libs and stuff, and I used the AVD Manager to download an AVD image an setup an emulator.
  • Copying over the test app project dir to my work PC
  • Copying over the updated Android SDK dir to my work PC (with the AVD image, etc)
  • Copying over the gradle caches to my work PC
7
  • 1
    a good justification to work at home :)
    – firegloves
    Jan 6, 2017 at 18:13
  • 1
    you could try old Eclipse
    – firegloves
    Jan 6, 2017 at 18:14
  • 1
    Ant may be an option for you (but the configuration time might not be worth it). Offline mode should work after you built it at least once while being connected. Jan 6, 2017 at 18:19
  • The most work being done today on offline builds probably is in the world of continuous integration servers, so you can see how they handle it. You could look to see if a different supported build system (e.g., Buck) can handle offline builds. Jan 6, 2017 at 18:23
  • 1
    I also want to do my work without the Gradle, it's too heavy and slow. please go back to native IDE, not the Gradle.
    – OfusJK
    Dec 19, 2017 at 2:39

4 Answers 4

1

At least you need internet connection once for the first build, then you can go to settings & enable offline. then you can build without the internet connection. Android Studio makes life easier. Anything other than that is going to very hard.

1

You can use this gist to download dependencies to a local folder. You can then use:

repositories {
   maven {
      url uri('c:/path/to/repo') 
   } 
} 

To work offline

0

Shameless plug: I wrote a series of scripts to build a Java/Kotlin Android app, including dependencies, without Gradle. There's a separate script to download packages, which is configured to look for AndroidX packages by default but you can provide it a full URL instead. After that point, running the other scripts is enough to build the app offline.

Link: https://github.com/jbendtsen/tiny-android-template

-1

You can do it through the Intellij with android plugin, however somewhat unsupported features are still existed.

Mostly I work on Android Studio sometimes I'm using IntelliJ community version. please try...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.