iT邦幫忙

0

第31天~從開啟舊專案方法(番外篇)

Tzu 2022-02-06 09:43:211677 瀏覽
  • 分享至 

  • xImage
  •  

居然還有第31天~

此篇的上一篇是https://ithelp.ithome.com.tw/articles/10281877


從開啟舊專案方法~因為安卓就是變來變去~

(現在很流行的月老電影的台詞就是~所謂的長大就是發現甚麼都會變來變去的時候)
/images/emoticon/emoticon20.gif

https://ithelp.ithome.com.tw/upload/images/20220206/20119035T5EMVIuf8b.png

build.gradle檔 右鍵 記事本打開~

https://ithelp.ithome.com.tw/upload/images/20220206/20119035ORDCVJsNos.png

找到-dependenciew

https://ithelp.ithome.com.tw/upload/images/20220206/20119035jL2sCZDCPp.png

對照自己的版本-

https://ithelp.ithome.com.tw/upload/images/20220206/20119035zgeeTW6O4w.png

https://developer.android.com/studio/preview/features

去改

classpath 'com.android.tools.build:gradle:3.2.1'

https://ithelp.ithome.com.tw/upload/images/20220206/20119035CTA7UbRABj.png

變成
https://ithelp.ithome.com.tw/upload/images/20220206/20119035BvXpH71LrY.png

classpath 'com.android.tools.build:gradle:7.0.4'

然後存檔關掉


再到android~打開指定這個

https://ithelp.ithome.com.tw/upload/images/20220206/20119035v15YX5QNjH.png

打開後~開始修正之旅~

https://ithelp.ithome.com.tw/upload/images/20220206/20119035sQFQ4izQrX.png

然後開始檢查裡面反後紅的部分-

https://ithelp.ithome.com.tw/upload/images/20220206/20119035TABClexSzM.png

後來發現說是

classpath 'com.android.tools.build:gradle:7.0.4'

高於4.8

那改成

classpath 'com.android.tools.build:gradle:4.1.1'

來試試~還是不行~

發現targetSdkVersion 28反紅-

https://ithelp.ithome.com.tw/upload/images/20220206/20119035G2XCwoDiHr.png

來看看其他可以跑得專案是多少~

https://ithelp.ithome.com.tw/upload/images/20220206/20119035nMTtNNJOm9.png

改成
targetSdkVersion 31
來試試~

https://ithelp.ithome.com.tw/upload/images/20220206/20119035gcFAC9MrwK.png

馬上改完沒反應~所以我關起來Android 又打開~

https://ithelp.ithome.com.tw/upload/images/20220206/20119035hGfKf1vp0i.png

現在反紅這句 'com.android.support:appcompat-v7:28.0.0'

再看看可以開的是多少~

https://ithelp.ithome.com.tw/upload/images/20220206/20119035uIyUpZtdzu.png

改成
implementation 'androidx.appcompat:appcompat:1.4.1'
來試試~
馬上改完沒反應~所以我關起來Android 又打開~


出現 錯誤-
Caused by: org.gradle.api.tasks.StopExecutionException: Your project path contains non-ASCII characters. This will most likely cause the build to fail on Windows. Please move your project to a different directory. See http://b.android.com/95744 for details. This warning can be disabled by adding the line 'android.overridePathCheck=true' to gradle.properties file in the project directory.

查了一下-原因是 Android Studio 專案路徑包含中文!

https://gn02214231.pixnet.net/blog/post/206066407-android-studio-%E8%B7%AF%E5%BE%91%E9%8C%AF%E8%AA%A4

那我開個路徑再打開

C:\Users\User\AndroidStudioProjects\ICRTRadio_20190330

https://ithelp.ithome.com.tw/upload/images/20220206/201190356n4jVXlAYU.png

馬上改完沒反應~所以我關起來Android 又打開~

現在是出錯沒有了~但是還是不能跑

https://ithelp.ithome.com.tw/upload/images/20220206/20119035wGtybK5pOm.png

因為沒有android的圖案可以開-但是都沒有反紅0.0

https://ithelp.ithome.com.tw/upload/images/20220206/20119035h8FrBTRGo1.png

改天再來研究~0.0



圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言