android Flutter释放APK崩溃上bixolon sdk调用插件

xqk2d5yq  于 2023-08-01  发布在  Android
关注(0)|答案(1)|浏览(109)

我试图在我的flutter插件中使用Bixolon SDK,在调试模式下,一切都很好,工作完美。但是,当我去释放模式它的崩溃,应用程序关闭,并显示以下错误:

F/example.alsahi(21380): thread.cc:2155] No pending exception expected: java.lang.ClassNotFoundException: Didn't find class "com.bixolon.commonlib.emul.EscPosEmul" on path: DexPathList[[zip file "/data/app/com.example.alsahil-SQ9CSxBQ66--Q9wfyJTfmQ==/base.apk"],nativeLibraryDirectories=[/data/app/com.example.alsahil-SQ9CSxBQ66--Q9wfyJTfmQ==/lib/arm, /data/app/com.example.alsahil-SQ9CSxBQ66--Q9wfyJTfmQ==/base.apk!/lib/armeabi-v7a, /system/lib, /system/vendor/lib]]
F/example.alsahi(21380): thread.cc:2155]   at java.lang.Class dalvik.system.BaseDexClassLoader.findClass(java.lang.String) (BaseDexClassLoader.java:134)
F/example.alsahi(21380): thread.cc:2155]   at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String, boolean) (ClassLoader.java:379)    
F/example.alsahi(21380): thread.cc:2155]   at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String) (ClassLoader.java:312)
F/example.alsahi(21380): thread.cc:2155]   at java.lang.String java.lang.Runtime.nativeLoad(java.lang.String, java.lang.ClassLoader) (Runtime.java:-2)
F/example.alsahi(21380): thread.cc:2155]   at void java.lang.Runtime.loadLibrary0(java.lang.ClassLoader, java.lang.String) (Runtime.java:1014)     
F/example.alsahi(21380): thread.cc:2155]   at void java.lang.System.loadLibrary(java.lang.String) (System.java:1669)
F/example.alsahi(21380): thread.cc:2155]   at void j.d.<clinit>() (:-1)
F/example.alsahi(21380): thread.cc:2155]   at void n.a.a.b.<init>(android.content.Context) (:-1)
F/example.alsahi(21380): thread.cc:2155]   at void n.a.a.c.a(byte[], java.lang.String, java.lang.String, android.content.Context) (:-1)
F/example.alsahi(21380): thread.cc:2155]   at void n.a.a.a.h(i.a.c.a.i, i.a.c.a.j$d) (:-1)
F/example.alsahi(21380): thread.cc:2155]   at void i.a.c.a.j$a.a(java.nio.ByteBuffer, i.a.c.a.b$b) (:-1)
F/example.alsahi(21380): thread.cc:2155]   at void io.flutter.embedding.engine.f.c.i(io.flutter.embedding.engine.f.c$d, java.nio.ByteBuffer, int) (:-1)
F/example.alsahi(21380): thread.cc:2155]   at void io.flutter.embedding.engine.f.c.j(java.lang.String, io.flutter.embedding.engine.f.c$d, java.nio.ByteBuffer, int, long) (:-1)
F/example.alsahi(21380): thread.cc:2155]   at void io.flutter.embedding.engine.f.c.k(java.lang.String, io.flutter.embedding.engine.f.c$d, java.nio.ByteBuffer, int, long) (:-1)
F/example.alsahi(21380): thread.cc:2155]   at void io.flutter.embedding.engine.f.a.run() (:-1)
F/example.alsahi(21380): thread.cc:2155]   at void android.os.Handler.handleCallback(android.os.Message) (Handler.java:873)
F/example.alsahi(21380): thread.cc:2155]   at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:99)
F/example.alsahi(21380): thread.cc:2155]   at void android.os.Looper.loop() (Looper.java:214)
F/example.alsahi(21380): thread.cc:2155]   at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:7156)
F/example.alsahi(21380): thread.cc:2155]   at java.lang.Object java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object[]) (Method.java:-2)
F/example.alsahi(21380): thread.cc:2155]   at void com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run() (RuntimeInit.java:494)
F/example.alsahi(21380): thread.cc:2155]   at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:975)
F/example.alsahi(21380): thread.cc:2155]
F/example.alsahi(21380): runtime.cc:577] Runtime aborting...
F/example.alsahi(21380): runtime.cc:577] Dumping all threads without appropriate locks held: thread list lock

字符串
这是我的应用级构建gradle:
compileSdkVersion flutter.compileSdkVersion

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}

defaultConfig {
    // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
    applicationId "com.example.alsahil"
    minSdkVersion 21
    targetSdkVersion flutter.targetSdkVersion
    versionCode flutterVersionCode.toInteger()
    versionName flutterVersionName
    multiDexEnabled true
}
signingConfigs {
    release {
        keyAlias keystoreProperties['keyAlias']
        keyPassword keystoreProperties['keyPassword']
        storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
        storePassword keystoreProperties['storePassword']
    }
}

buildTypes {
    release {
        signingConfig signingConfigs.release
    }
}


这是我的AndroidManifest.xml

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.alsahil">
    <uses-feature android:name="android.hardware.bluetooth_le" android:required="true"/>
    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
    <uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.BLUETOOTH"/>
    <uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>


photo that show the plugin files
任何帮助都是感激的。

deyfvvtc

deyfvvtc1#

问题:
似乎在发布模式下存在访问问题*com.bixolon.commonlib.emul.EscPosEmul***。
解决方案:
1.为了避免这种情况,proguard会在
app/gradle**上帮助我们:

buildTypes {
            release {
                signingConfig signingConfigs.debug
    
                // Add this line below
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
        }

字符串
1.创建proguard-rules.pro文件并添加此行:

-keep class com.bixolon.** { *; }

相关问题