I updated from Android Studio 2.2.3 to Android Studio 2.3 yesterday, and I ran into the following two problems:
我昨天從Android Studio 2.2.3更新到Android Studio 2.3,我遇到了以下兩個問題:
Upon updating, Gradle 3.2 was installed by default, but syncing my project would not work and I kept getting an error saying "Gradle 3.3 is required". Using the default Gradle wrapper doesn't work. The only way to fix this was to download Gradle 3.3 manually and point to the directory in build settings.
更新后,默認情況下安裝了Gradle 3.2,但同步我的項目不起作用,我不斷收到錯誤消息“需要Gradle 3.3”。使用默認的Gradle包裝器不起作用。解決此問題的唯一方法是手動下載Gradle 3.3並指向構建設置中的目錄。
On running my project, I kept getting a string of errors involving my BaseApplication class which extends MultiDexApplication. The error goes something like this:
在運行我的項目時,我不斷收到涉及擴展MultiDexApplication的BaseApplication類的一系列錯誤。錯誤是這樣的:
Error:(19, 62) error: package android.support.multidex does not exist
錯誤:(19,62)錯誤:包android.support.multidex不存在
I am unable to resolve this error. I have buildToolsVersion '25.0.2', and my project compiled and ran properly before upgrading to Android Studio 2.3. Can anyone help me with this problem?
我無法解決此錯誤。我有buildToolsVersion '25 .0.2',我的項目在升級到Android Studio 2.3之前已經編譯並正常運行。任何人都可以幫我解決這個問題嗎?
2 个解决方案
#1
62
I have passed the building. my solution is that adding explicit dependencies in build.gradle. compile 'com.android.support:multidex:1.0.1'
我已經通過了大樓。我的解決方案是在build.gradle中添加顯式依賴項。編譯'com.android.support:multidex:1.0.1'
#2
6
The solution to this problem is to add the following:
此問題的解決方案是添加以下內容:
dependencies {
compile 'com.android.support:multidex:1.0.1'
}
in your build.gradle file.
在build.gradle文件中。
This was not required prior to Gradle 3.3. This problem occurs only for apps that support Android versions below Lollipop (API level 21).
在Gradle 3.3之前不需要這樣做。僅在支持Lollipop(API級別21)以下的Android版本的應用程序中會出現此問題。
References:
1. Android 5.0之前的Multidex支持。