我有一個Ubuntu的Xenial VM在OpenStack的運行,還有我已經下載了最新的Android SDK工具(tools_r25.2.3-linux.zip)從https://developer.android.com/studio/index.html。一切都在順利進行配置:無法找到與哈希字符串 '的android-25' 目標,雖然Android的25實際安裝
JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
ANDROID_HOME=<ANDROID_SDK_PATH>
PATH=${PATH}:${ANDROID_HOME}
echo "sdk.dir=<ANDROID_SDK_PATH>" > <MY_ANDROID_PROJECT_PATH>/local.properties
但是,當嘗試執行任務:./gradlew clean
,出現錯誤:
Preparing "Install Android SDK Build-Tools 25".
Warning: Trying to install into ${ANDROID_HOME}/build-tools/25.0.0/ but package "Android SDK Tools 25.2.4" already exists at ${ANDROID_HOME}. It must be deleted or moved away before installing into a child directory.
Preparing "Install Android SDK Platform 25".
Warning: Trying to install into ${ANDROID_HOME}/platforms/android-25/ but package "Android SDK Tools 25.2.4" already exists at ${ANDROID_HOME}. It must be deleted or moved away before installing into a child directory.
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':demo'.
> Failed to install the following SDK components:
[Android SDK Build-Tools 25, Android SDK Platform 25]
Please install the missing components using the SDK manager in Android Studio.
而實際上作爲錯誤日誌中提到,我已經安裝了所需的工具。運行$ANDROID_HOME/bin/sdkmanager --list
顯示我已安裝的軟件包:
Installed packages:
Path | Version | Description | Location
------- | ------- | ------- | -------
build-tools;25.0.0 | 25.0.0 | Android SDK Build-Tools 25 | build-tools/25.0.0/
extras;android;m2repository | 41.0.0 | Android Support Repository, re... | extras/android/m2repository/
platform-tools | 25.0.2 | Android SDK Platform-Tools 25.0.2 | platform-tools/
platforms;android-25 | 3 | Android SDK Platform 25, rev 3 | platforms/android-25/
tools | 25.2.4 | Android SDK Tools 25.2.4 | tools/
這裏有什麼問題?我對這裏的SDK路徑有點懷疑。
換句話說,除非您手動執行某些清理,否則最新的更新會破壞事情?這似乎不是一個會持續很長時間的問題......移動的東西只會讓下一次更新變得更加困惑。不幸的是,這也發生在Windows上。 :( – lilbyrdie
是的,這個文件結構在發行說明中沒有提及,當用戶下載SDK並執行全新設置時(使用通常的方式來配置'$ ANDROID_HOME'),那麼它就搞砸了。對於已經有SDK的其他用戶,只需執行更新,它就不會中斷。我有這個問題只是因爲我有一個Docker鏡像,它在構建它時下載SDK。 –
現在是2017年5月16日,並且作爲一個新項目的創建,這些同樣愚蠢的問題依然存在。Google的幼兒園軟件團隊不像我們其他人一樣閱讀Stackoverflow嗎?程序員的名字是什麼?平臺:嘗試在基於win10的系統上使用A25,儘可能更新所有更新 – carl