Just a Computer Graphics Studio & My Life

還沒有真正開發過Android native app,就要先用Ionic來編譯Hybrid app的Android版本,當然一開始是最難的,因為前方有一堆你還沒遇過的問題擋在前面,途中我已劈荊斬棘,當前我遇到中文檔名的問題,當然一開始不曉得,查了網路上前人的經驗才疑惑地嘗試。

明明Hybrid app的iOS版本沒有問題,卻在透過Android Studio編譯成Hybrid app的Android版本有問題⋯⋯

什麼樣的中文檔名呢?舉個例子:

happyboy 拷貝.png

因為直接複製影像,所以會有「拷貝」,很符合我當下的心情XD~

然後在輸入指令:

ionic run android

接下來一直跑跑跑~

BUILD FAILED

Total time: 4.089 secs

Error: /Users/jason/Missions/babyteach/platforms/android/gradlew: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ‘:processDebugResources’.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process ‘command ‘/Users/jason/Library/Android/sdk/build-tools/25.0.3/aapt" finished with non-zero exit value 1

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

上網google搜尋:

Execution failed for task ‘:processDebugResources’.

才發現原來是中文檔名的問題,我找遍專案中所有檔案,尤其是圖片檔,移除中文字之後再度編譯,就解決啦⋯⋯

BUILD SUCCESSFUL

Total time: 25.72 secs

Built the following apk(s):
/Users/jason/Missions/babyteach/platforms/android/build/outputs/apk/android-debug.apk

ANDROID_HOME=/Users/jason/Library/Android/sdk

JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_111.jdk/Contents/Home

Error: adb: Command failed with exit code 1 Error output:
error: could not install *smartsocket* listener: Address already in use
ADB server didn’t ACK
* failed to start daemon *
error: cannot connect to daemon

去指定的資料夾中就會看到APK檔:

android-debug.apk

可以安裝到實機上測試!

若筆電有用USB連接Android手機,編譯訊息:

BUILD SUCCESSFUL

Total time: 5.322 secs

Built the following apk(s):

/Users/jason/MyIonicProject/platforms/android/build/outputs/apk/android-debug.apk

ANDROID_HOME=/Users/jason/Library/Android/sdk

JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_111.jdk/Contents/Home

No target specified, deploying to device ‘5956a85d’.

Skipping build…

Built the following apk(s):

/Users/jason/MyIonicProject/platforms/android/build/outputs/apk/android-debug.apk

Using apk: /Users/jason/MyIonicProject/platforms/android/build/outputs/apk/android-debug.apk

Package name: com.ionicframework.myionicproject523874

LAUNCH SUCCESS

這個問題搞了一個禮拜><~

參考:“Build Failed" :app:processDebugResources FAILED、Ionic – Deploying to a Device

廣告

發表留言

在下方填入你的資料或按右方圖示以社群網站登入:

WordPress.com Logo

您的留言將使用 WordPress.com 帳號。 登出 / 變更 )

Twitter picture

您的留言將使用 Twitter 帳號。 登出 / 變更 )

Facebook照片

您的留言將使用 Facebook 帳號。 登出 / 變更 )

Google+ photo

您的留言將使用 Google+ 帳號。 登出 / 變更 )

連結到 %s

標籤雲

%d 位部落客按了讚: