1. 程式人生 > >編譯網易雲信專案錯誤問題記錄

編譯網易雲信專案錯誤問題記錄

錯誤一:

Error:(6, 0) Gradle DSL method not found: 'google()'

出現這樣的錯誤,主要的原因就是AndroidStudio沒有升級到3.0和Gradle plugin沒有升級到V3.x版本。解決該問題如下:
這裡寫圖片描述
google() 注掉

maven {
url 'https://maven.google.com'
}

錯誤二:

Error:This Gradle plugin requires Studio 3.0 minimum

出現這樣的錯誤,也是因為Androidstudio版本不是3.0,但是卻運行了Android3.0的專案。解決該問題如下:
這裡寫圖片描述


gradle.properties 新增
android.injected.build.model.only.versioned = 3

錯誤三:

Installation failed with message INSTALL_FAILED_TEST_ONLY.
It is possible that this issue is resolved by uninstalling an existing version of the apk if it is present, and then re-installing.
WARNING: Uninstalling will remove the application data!
Do you want to uninstall the existing application?


這個問題挺糾結的,一直因為是MIUI6.0優化的問題,但是並不是這個引起的問題,有技術部落格說要讓下面兩個版本對應:

這裡寫圖片描述

這裡寫圖片描述

在AS 2.3上面:
classpath 'com.android.tools.build:gradle:2.3.3'
對應:
distributionUrl=https://services.gradle.org/distributions/gradle-3.3-all.zip

在AS 3.0上面:
classpath 'com.android.tools.build:gradle:3.0.0
對應:
distributionUrl=https://services.gradle.org/distributions/gradle-4.1-all.zip


但是並沒有解決我的問題,希望能解決其他小夥伴的問題。
最後在stackoverflow 有個兄弟說在啟動加-t 引數,一試用真的好使了。專案可以運行了。解決該問題如下:

這裡寫圖片描述

這裡寫圖片描述

參考連結

https://stackoverflow.com/questions/25274296/adb-install-fails-with-install-failed-test-only

http://www.jacpy.com/2017/09/21/android-installation-failed-with-message-INSTALL-FAILED-TEST-ONLY-md.html

http://blog.csdn.net/shenggaofei/article/details/78165940

https://stackoverflow.com/questions/45781489/error6-0-gradle-dsl-method-not-found-google

這件事告訴我們,抓緊升級AndroidStudio

歡迎使用程式設計師自己的導航網站