android studio 2.3 multidex,升級到Android Studio 2.3后,獲取“package android.support.multidex”不存在...

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支持。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值