【发布时间】:2019-09-05 07:34:33
【问题描述】:
您好,我正在尝试使用此库中的 https://github.com/Swati4star/Images-to-PDF ImagesToPDF 函数。我已经添加了我的应用程序中所需的所有类。
现在我在添加 ImagesToPDF 函数之前在我的应用程序中使用了 picasso。
现在添加后出现以下错误:
java.lang.NoSuchMethodError: No static method with(Landroid/content/Context;)Lcom/squareup/picasso/Picasso; in class Lcom/squareup/picasso/Picasso; or its super classes (declaration of 'com.squareup.picasso.Picasso' appears in /data/app/com.example.onboardingversion2-sJCkixxNOR2KPNLmYYdvpQ==/base.apk!classes2.dex)
以下函数出错:
/**
* Opens Matisse activity to select Images
*/
private void selectImages() {
Matisse.from(this)
.choose(MimeType.ofImage(), false)
.countable(true)
.capture(true)
.captureStrategy(new CaptureStrategy(true, AUTHORITY_APP))
.maxSelectable(1000)
.imageEngine(new PicassoEngine())
.forResult(INTENT_REQUEST_GET_IMAGES);
}
应用程序崩溃并给出错误。我添加了应用程序并设置了Multidex
public class MyApplication extends Application {
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(base);
}
}
我还在 gradle 中添加了 multidexEnabled true。仍然抛出错误。 请帮忙。谢谢。
【问题讨论】:
-
你在清单文件中定义了应用类吗?
-
是的,我做到了。 @HemantParmar
-
更新您的 picasso gradle 版本并检查。
-
我添加了最新版本的毕加索@HemantParmar
标签: java android picasso android-multidex matisse