gpt4 book ai didi

java - 找不到引用的类 java.lang.invoke.LambdaMetafactory

转载 作者:搜寻专家 更新时间:2023-10-30 21:02:42 24 4
gpt4 key购买 nike

我包括了AndroidRate library在我的项目中

android {
...
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
...
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
implementation 'com.android.support:multidex:1.0.2'
implementation 'com.android.support:support-annotations:27.0.2'
implementation 'com.android.support:support-compat:27.0.2'
implementation 'com.android.support:appcompat-v7:27.0.2'
implementation 'com.google.android.gms:play-services-base:11.6.2'
implementation 'com.google.android.gms:play-services-cast:11.6.2'
implementation 'com.google.firebase:firebase-core:11.6.2'
implementation 'com.google.firebase:firebase-crash:11.6.2'
implementation 'com.google.firebase:firebase-appindexing:11.6.2'
implementation 'com.vorlonsoft:androidrate:1.0.7'
debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.5.4'
releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.4'
}

对于下面的代码,我得到:

Warning:com.MyCompany.MyApp.MyAppClass: can't find referenced class java.lang.invoke.LambdaMetafactory

Warning:there were 2 unresolved references to classes or interfaces.

Warning:Exception while processing task java.io.IOException: Please correct the above warnings first.

Error:Execution failed for task ':mobile:transformClassesAndResourcesWithProguardForFree_Release'.

Job failed, see logs for details

AppRate.with(this)
.setStoreType(StoreType.GOOGLEPLAY)
.setInstallDays((byte)1) // default 10, 0 means install day.
.setLaunchTimes((byte)3) // default 10
.setRemindInterval((byte)1) // default 1
.setShowLaterButton(true) // default true
.setDebug(false) // default false
.setOnClickButtonListener(which -> Log.d(TAG, "RateButton: " + Byte.toString(which) + ""))
.monitor();

另一方面,下面的代码工作正常:

AppRate.with(this)
.setStoreType(StoreType.GOOGLEPLAY)
.setInstallDays((byte)1) // default 10, 0 means install day.
.setLaunchTimes((byte)3) // default 10
.setRemindInterval((byte)1) // default 1
.setShowLaterButton(true) // default true
.setDebug(false) // default false
.setOnClickButtonListener(new OnClickButtonListener() { // callback listener.
@Override
public void onClickButton(byte which) {
Log.d(TAG, "RateButton: " + Byte.toString(which) + "");
}
})
.monitor();

如何修复 lambda 代码变体的错误 .setOnClickButtonListener(which -> Log.d(TAG, "RateButton: " + Byte.toString(which) + ""))

最佳答案

忽略这些警告应该是安全的。只需在您的 proguard 配置文件中添加以下内容。

-dontwarn java.lang.invoke.**

关于java - 找不到引用的类 java.lang.invoke.LambdaMetafactory,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47783672/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com