gpt4 book ai didi

android - com.google.zxing.qrcode.detector : -> java. lang.NoSuchMethodError:不在棉花糖上扫描

转载 作者:行者123 更新时间:2023-12-04 04:23:04 24 4
gpt4 key购买 nike

安卓工作室 3.6

安卓 6.0

应用程序/build.gradle:

android {
//viewBinding.enabled = true
dataBinding {
enabled = true
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
minSdkVersion 23
targetSdkVersion 29
versionCode 2
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation('com.crashlytics.sdk.android:crashlytics:2.10.1@aar') { transitive = true; }
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0-rc01'
implementation 'com.google.android.material:material:1.2.0-alpha01'
implementation 'com.google.zxing:core:3.4.0'
implementation 'org.altbeacon:android-beacon-library:2.16.3'
implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.0.0'
implementation 'androidx.lifecycle:lifecycle-extensions:2.1.0'
implementation 'androidx.viewpager2:viewpager2:1.0.0-beta05'
implementation 'com.journeyapps:zxing-android-embedded:4.0.0'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.0'
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.0"

testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation "androidx.core:core-ktx:+"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"

}

在我的 Activity 中
class QRScanActivity : RootActivity() {
private lateinit var dataBinding: QrScanActivityBinding
private val REQUEST_PERMISSION = "REQUEST_PERMISSION"
private val REQUEST_CODE_CAMERA = 1
private lateinit var beepManager: BeepManager

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
dataBinding =
DataBindingUtil.setContentView<QrScanActivityBinding>(this, R.layout.qr_scan_activity)
dataBinding.setHandler(this)
init()
}

private fun initLogic() {
dataBinding.decoratedBarcodeView.decodeContinuous(object : BarcodeCallback {
override fun barcodeResult(result: BarcodeResult?) {
beepManager.playBeepSoundAndVibrate();
finish();
}

override fun possibleResultPoints(resultPoints: MutableList<ResultPoint>?) {

}
})
}

在 xml 布局中:
<com.journeyapps.barcodescanner.DecoratedBarcodeView
android:id="@+id/decoratedBarcodeView"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginBottom="@dimen/default_margin"
app:layout_constraintBottom_toTopOf="@+id/qrButtonScan"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/toolBarContainer" />

成功工作 安卓 9.0 .好的。

但是当我开始时 安卓 6.0 我得到错误:
10-28 16:28:35.145 D/com.myproject.ui.actviity.QRScanActivity( 2405): possibleResultPoints:
10-28 16:28:35.484 E/AndroidRuntime( 2405): FATAL EXCEPTION: DecoderThread
10-28 16:28:35.484 E/AndroidRuntime( 2405): Process: com.myproject.debug, PID: 2405
10-28 16:28:35.484 E/AndroidRuntime( 2405): java.lang.NoSuchMethodError: No interface method sort(Ljava/util/Comparator;)V in class Ljava/util/List; or its super classes (declaration of 'java.util.List' appears in /system/framework/core-libart.jar)
10-28 16:28:35.484 E/AndroidRuntime( 2405): at com.google.zxing.qrcode.detector.FinderPatternFinder.selectBestPatterns(FinderPatternFinder.java:616)
10-28 16:28:35.484 E/AndroidRuntime( 2405): at com.google.zxing.qrcode.detector.FinderPatternFinder.find(FinderPatternFinder.java:164)
10-28 16:28:35.484 E/AndroidRuntime( 2405): at com.google.zxing.qrcode.detector.Detector.detect(Detector.java:81)
10-28 16:28:35.484 E/AndroidRuntime( 2405): at com.google.zxing.qrcode.QRCodeReader.decode(QRCodeReader.java:77)
10-28 16:28:35.484 E/AndroidRuntime( 2405): at com.google.zxing.MultiFormatReader.decodeInternal(MultiFormatReader.java:173)
10-28 16:28:35.484 E/AndroidRuntime( 2405): at com.google.zxing.MultiFormatReader.decodeWithState(MultiFormatReader.java:87)
10-28 16:28:35.484 E/AndroidRuntime( 2405): at com.journeyapps.barcodescanner.Decoder.decode(Decoder.java:75)
10-28 16:28:35.484 E/AndroidRuntime( 2405): at com.journeyapps.barcodescanner.Decoder.decode(Decoder.java:49)
10-28 16:28:35.484 E/AndroidRuntime( 2405): at com.journeyapps.barcodescanner.DecoderThread.decode(DecoderThread.java:146)
10-28 16:28:35.484 E/AndroidRuntime( 2405): at com.journeyapps.barcodescanner.DecoderThread.access$000(DecoderThread.java:22)
10-28 16:28:35.484 E/AndroidRuntime( 2405): at com.journeyapps.barcodescanner.DecoderThread$1.handleMessage(DecoderThread.java:38)
10-28 16:28:35.484 E/AndroidRuntime( 2405): at android.os.Handler.dispatchMessage(Handler.java:98)
10-28 16:28:35.484 E/AndroidRuntime( 2405): at android.os.Looper.loop(Looper.java:148)
10-28 16:28:35.484 E/AndroidRuntime( 2405): at android.os.HandlerThread.run(HandlerThread.java:61)
10-28 16:28:35.486 W/ActivityManager( 780): Force finishing activity com.myproject.debug/com.myproject.ui.actviity.QRScanActivity
10-28 16:28:35.486 E/CrashlyticsCore( 2405): Error occurred sending report com.crashlytics.android.core.SessionReport@451f81a
10-28 16:28:35.487 E/CrashlyticsCore( 2405): Error occurred sending report com.crashlytics.android.core.SessionReport@e9abf4b
10-28 16:28:35.488 E/CrashlyticsCore( 2405): Error occurred sending report com.crashlytics.android.core.SessionReport@d2e7d28
10-28 16:28:35.491 D/CameraPreview( 2405): pause()

最佳答案

https://github.com/zxing/zxing/issues/1170#issuecomment-494778246

Tough call there. On the one hand I can't publish the Android appanymore, so it's kind of 'deprecated'. The core library can still beused outside Android, or in another Android app. That app would haveto target API 24, yes. The app in the project can't target API 24, soit also doesn't quite make sense to leave it in a state where it won'trun on API < 24. Another solution is to modify the Android app todepend on the 3.3.x core library and leave it there.


https://github.com/zxing/zxing/issues/1170#issuecomment-533527019

Please read all of the messages above. You can a) use 3.3.x, or b)target API 24.

关于android - com.google.zxing.qrcode.detector : -> java. lang.NoSuchMethodError:不在棉花糖上扫描,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58592840/

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