问题
I'm trying to build the project with offline-mode in Android Studio. So, Unzip the gradle-plugin (version 4.4) and set Gradle path & Service directory path. Finally check 'Offline work'. When Sync the gradle, it occur the problem.
The Error Message
'No cached version of com.android.tools.build:gradle:3.1.4 available for offline mode.'
Installed SDK Platform List
Android API 28
Android SDK Platform 28
Sources for Android 28
Android 8.0(Oreo)
Android SDK Platform 26
Sources for Android 26
Installed SDK Tools
Android SDK Build-Tools
Android Emulator (27.3.10)
Android SDK Platform-Tools (28.0.1)
Android SDK Tools (26.1.1)
Support Repository
Android Support Repository (47.0.0) ----- I want to upgrade this...
Google Repository (58)
I'm sorry about no capture my screen. My company doesn't provider internet...
回答1:
You'll probably need to get connected to the internet for one time because of dependencies you have already added in build.gradle
or libraries which needs to be downloaded.
Or, if there are needed jar libraries available on the internet or in GitHub, you can add them to use in offline condition.
Otherwise, if you are adding dependencies to build.gradle
and using gradle
for that, you'll need internet for the first time downloading of libraries and caching them and after that, you can check Offline mode.
回答2:
It's sdk problem. You just have to delete android studio and then reinstall that with complete new sdk tools. Emulator will not be offline.
The other method is to choose emulator with lower API like Oreo. It will not be offline anymore. But first solution is the proper one.
来源:https://stackoverflow.com/questions/52215947/android-studio-3-1-4-offline-mode