使用Android Studio编译报如下异常
IOException: https://dl.google.com/android/repository/addons_list-3.xml
java.net.ConnectException: Connection refused: connect
IOException: https://dl.google.com/android/repository/addons_list-2.xml
java.net.ConnectException: Connection refused: connect
IOException: https://dl.google.com/android/repository/addons_list-1.xml
java.net.ConnectException: Connection refused: connect
Failed to download any source lists!
File C:\Users\Administrator\.android\repositories.cfg could not be loaded.
IO exception while downloading manifest:
java.net.ConnectException: Connection refused: connect
at java.base/java.net.PlainSocketImpl.connect0(Native Method)
at java.base/java.net.PlainSocketImpl.socketConnect(PlainSocketImpl.java:101)
at java.base/java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:399)
at java.base/java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:242)
at java.base/java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:224)
Still waiting for package manifests to be fetched remotely.
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.8.3/userguide/command_line_interface.html#sec:command_line_warnings
BUILD SUCCESSFUL in 21s
首先,使用“gradlew clean”
D:\Android\AndroidStudioProjects\GestureClassification>gradlew clean
Welcome to Gradle 6.8.3!
Here are the highlights of this release:
- Faster Kotlin DSL script compilation
- Vendor selection for Java toolchains
- Convenient execution of tasks in composite builds
- Consistent dependency resolution
For more details see https://docs.gradle.org/6.8.3/release-notes.html
------------------------------------------------------------
Gradle 6.8.3
------------------------------------------------------------
Build time: 2021-02-22 16:13:28 UTC
Revision: 9e26b4a9ebb910eaa1b8da8ff8575e514bc61c78
Kotlin: 1.4.20
Groovy: 2.5.12
Ant: Apache Ant(TM) version 1.10.9 compiled on September 27 2020
JVM: 1.8.0_221 (Oracle Corporation 25.221-b11)
OS: Windows 10 10.0 amd64
D:\Android\AndroidStudioProjects\GestureClassification>gradlew clean
Starting a Gradle Daemon, 2 incompatible and 8 stopped Daemons could not be reused, use --status for details
BUILD SUCCESSFUL in 10s
2 actionable tasks: 2 up-to-date
其次,使用“gradlew build”编译应用
D:\Android\AndroidStudioProjects\GestureClassification>gradlew build
Warning: Mapping new ns http://schemas.android.com/repository/android/common/02 to old ns http://schemas.android.com/repository/android/common/01
Warning: Mapping new ns http://schemas.android.com/repository/android/generic/02 to old ns http://schemas.android.com/repository/android/generic/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/02 to old ns http://schemas.android.com/sdk/android/repo/addon2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/02 to old ns http://schemas.android.com/sdk/android/repo/repository2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/02 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01
Warning: Mapping new ns http://schemas.android.com/repository/android/common/02 to old ns http://schemas.android.com/repository/android/common/01
Warning: Mapping new ns http://schemas.android.com/repository/android/generic/02 to old ns http://schemas.android.com/repository/android/generic/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/02 to old ns http://schemas.android.com/sdk/android/repo/addon2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/02 to old ns http://schemas.android.com/sdk/android/repo/repository2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/02 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01
> Task :app:stripDebugDebugSymbols
WARNING: Compatible side by side NDK version was not found. Default is 21.0.6113669.
Compatible side by side NDK version was not found. Default is 21.0.6113669.
Unable to strip the following libraries, packaging them as they are: libtensorflowlite_jni.so.
> Task :app:compileDebugJavaWithJavac
ע: D:\Android\AndroidStudioProjects\GestureClassification\app\src\main\java\org\tensorflow\lite\examples\gesture\Camera2BasicFragment.javaʹû�ѹʱ API
ע: D:\Android\AndroidStudioProjects\GestureClassification\app\src\main\java\org\tensorflow\lite\examples\gesture\Camera2BasicFragment.j
avaʹû�ѹʱ API
ע: йϸϢ, ʹ -Xlint:deprecation ±롣
> Task :app:compileReleaseJavaWithJavac
ע: D:\Android\AndroidStudioProjects\GestureClassification\app\src\main\java\org\tensorflow\lite\examples\gesture\Camera2BasicFragment.j
avaʹû�ѹʱ API
ע: йϸϢ, ʹ -Xlint:deprecation ±롣
> Task :app:lint
Ran lint on variant release: 95 issues found
Ran lint on variant debug: 95 issues found
Wrote HTML report to file:///D:/Android/AndroidStudioProjects/GestureClassification/app/build/reports/lint-results.html
Wrote XML report to file:///D:/Android/AndroidStudioProjects/GestureClassification/app/build/reports/lint-results.xml
> Task :app:stripReleaseDebugSymbols
Unable to strip the following libraries, packaging them as they are: libtensorflowlite_jni.so.
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.8.3/userguide/command_line_interface.html#sec:command_line_warnings
BUILD SUCCESSFUL in 2m 1s
50 actionable tasks: 50 executed
则应用最终会编译出来。