误删安卓Android sdk包,打包出现错误解决

手贱删了些sdk以腾电脑空间。结果ionic打包Android出错。

0,SDK Manager AVD Manager都打不开了啊,啊,啊,啊,啊。。。

这个也是需要下载Android SDK Manager,与下面相同。

1,Could not find gradle wrapper within Android SDK. Might need to update your Android SDK.

https://stackoverflow.com/questions/42613882/error-could-not-find-gradle-wrapper-within-android-sdk-might-need-to-update-yo

I just experienced the same problem.

It may be an occlusion in the instructions regarding how to install (or upgrade) Android Studio with all the SDK Tools which both you and I missed or possibly a bug created by a new release of Studio which does not follow the same file conventions as the older versions. I lean towards the latter since many of the SO posts on this topic seems to point to an ANDROID_PATH with a folder called android-sdk which does not appear in the latest (2.3.0.8) version.

There appears to be a workaround though, which I just got to work on my machine. Here's what I did:

    • Download tools_r25.2.3-windows.zip from Android Downloads.
    • Extracted zip on desktop
    • Replaced C:UsersusernameAppDataLocalAndroidsdk ools with extracted sub-folder tools/
    • In project folder:

      $ cordova platforms remove android
      $ cordova platforms add android

重新下载Android SDK tools 去官网,覆盖到Android目录下(C:Program Files (x86)Androidandroid-sdk)即可。

2,类似下面标题的一个错误,也是安装了GoogleApis好了。

failed to find target with hash string android-23

In my case, clearing caché didn't work.

On SDK Manager, be sure to check the box on "show package descriptions"; then you should also select the "Google APIs" for the version you are willing to install.

Install it and then you should be ok

ionic build android --prod --release出现如下错误:

BUILD FAILED

Total time: 8.809 secs

https://jcenter.bintray.com/com/android/support/support-v4/
Required by:
:android:unspecified
> Could not find any matches for com.android.support:support-v4:+ as no versions of com.android.support:support-v4 are available.
Required by:
:android:unspecified

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

Error: cmd: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all dependencies for configuration ':_debugCompile'.
> Could not find any matches for com.android.support:support-v4:24.1.1+ as no versions of com.android.support:support-v4 are available.
Searched in the following locations:
https://repo1.maven.org/maven2/com/android/support/support-v4/maven-metadata.xml
https://repo1.maven.org/maven2/com/android/support/support-v4/
https://jcenter.bintray.com/com/android/support/support-v4/maven-metadata.xml
https://jcenter.bintray.com/com/android/support/support-v4/
Required by:
:android:unspecified
> Could not find any matches for com.android.support:support-v4:+ as no versions of com.android.support:support-v4 are available.
Required by:
:android:unspecified

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Picked up _JAVA_OPTIONS: -Xmx512M

原因是手贱腾电脑空间删了些以为“没用”的sdk,谁知把“Android Support Repository”删了,打开SDK Manager 重新install就行了。

原文地址:https://www.cnblogs.com/towntowner/p/8647830.html