getui-flutter-plugin icon indicating copy to clipboard operation
getui-flutter-plugin copied to clipboard

执行 flutter buid apk 命令后,安装 apk 文件,应用获取不到 clientId

Open Hongyu-Zhuo opened this issue 4 years ago • 7 comments

问题

我用此仓库的 demo 测试,发现在执行 flutter build apkflutter install 命令后,应用获取不到clientId: 问题演示.gif

这个问题和我的应用的问题一致; 但是,在 debug 模式下,没有这个问题; 我使用 adb logcat 命令查看设备日志,发现了一下有可能是错误的信息:

E ple:pushservic: ----- class 'Lcom/igexin/push/extension/mod/SecurityUtils;' cl=0x12c716d8 -----
E ple:pushservic:   objectSize=233 (224 from super)
E ple:pushservic:   access=0x0008.0001
E ple:pushservic:   super='java.lang.Class<java.lang.Object>' (cl=0x0)
E ple:pushservic:   vtable (0 entries, 11 in super):
E ple:pushservic:   direct methods (9 entries):
E ple:pushservic:      0: void com.igexin.push.extension.mod.SecurityUtils.<clinit>()
E ple:pushservic:      1: byte[] com.igexin.push.extension.mod.SecurityUtils.a()
E ple:pushservic:      2: byte[] com.igexin.push.extension.mod.SecurityUtils.b(byte[], byte[], byte[])
E ple:pushservic:      3: byte[] com.igexin.push.extension.mod.SecurityUtils.c(byte[], byte[], byte[])
E ple:pushservic:      4: byte[] com.igexin.push.extension.mod.SecurityUtils.d(byte[])
E ple:pushservic:      5: byte[] com.igexin.push.extension.mod.SecurityUtils.e()
E ple:pushservic:      6: byte[] com.igexin.push.extension.mod.SecurityUtils.h(byte[])
E ple:pushservic:      7: byte[] com.igexin.push.extension.mod.SecurityUtils.j()
E ple:pushservic:      8: byte[] com.igexin.push.extension.mod.SecurityUtils.k()
E ple:pushservic:   static fields (3 entries):
E ple:pushservic:      0: java.lang.String com.igexin.push.extension.mod.SecurityUtils.a
E ple:pushservic:      1: boolean com.igexin.push.extension.mod.SecurityUtils.b
E ple:pushservic:      2: java.lang.String com.igexin.push.extension.mod.SecurityUtils.c
E ple:pushservic: 
E ple:pushservic: Failed to register native method com.igexin.push.extension.mod.SecurityUtils.f([B[B[B)[B in /data/app/com.getui.getuiflut_example-qEnGwT2ngc-MNizg8mGXJw==/base.apk

clientid: load1 so error = java.lang.UnsatisfiedLinkError: JNI_ERR returned from JNI_OnLoad in "/data/app/com.getui.getuiflut_example-qEnGwT2ngc-MNizg8mGXJw==/lib/arm64/libgetuiext3.so"

我的环境

flutter doctor

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, v1.12.13+hotfix.9, on Mac OS X 10.14.4 18E194d, locale zh-Hans-CN)
 
[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[✓] Xcode - develop for iOS and macOS (Xcode 11.2.1)
[✓] Android Studio (version 3.2)
[!] IntelliJ IDEA Ultimate Edition (version 2018.2.5)
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
[✓] Connected device (2 available)

! Doctor found issues in 1 category.

flutter --version

Flutter 1.12.13+hotfix.9 • channel stable • https://github.com/flutter/flutter.git
Framework • revision f139b11009 (2 weeks ago) • 2020-03-30 13:57:30 -0700
Engine • revision af51afceb8
Tools • Dart 2.7.2

Hongyu-Zhuo avatar Apr 14 '20 10:04 Hongyu-Zhuo

要先点击“initGetuiSdk”这个flatButton,触发初始化事件,才能点击getClientId image

bigbirdhzp avatar Apr 20 '20 10:04 bigbirdhzp

我点击的是 initGetuiSdk, 没有反应,上面我放了个gif; 我再检查一下是不是 flutter 版本的问题,麻烦有空再帮我看一下,谢谢!

还有,我第一次运行这个 demo 的时候,报了一个错误,然后我在 android/app/build.gradle中添加了一行代码:

android {
    compileSdkVersion 28

    lintOptions {
        disable 'InvalidPackage'
        checkReleaseBuilds false <<<===添加的代码
    }
}

Hongyu-Zhuo avatar Apr 20 '20 13:04 Hongyu-Zhuo

你自己按着个推文档来再配置一次,不行就找客服。

bigbirdhzp avatar Apr 21 '20 01:04 bigbirdhzp

android.enableR8=false

joeyczz avatar May 12 '20 17:05 joeyczz

android.enableR8=false

这个方法无效,我在新拉的这个仓库的 demo 中测的

Hongyu-Zhuo avatar Jun 28 '20 08:06 Hongyu-Zhuo

android.enableR8=false

这个方法无效,我在新拉的这个仓库的 demo 中测的

@ZZsuper 修改android/app/build.gradle文件

  minifyEnabled true
  useProguard true

to ->

  minifyEnabled false // 一定要主动关,不能省略这句

rurico avatar Jun 28 '20 08:06 rurico

个推官网说道:如果您的工程启用了 Proguard 混淆,即如果在app/build.gradle的android.buildTypes.release下配置了minifyEnabled true,为了避免个推 SDK 被错误混淆导致功能异常,需要在app/proguard-rules.pro混淆配置文件中添加如下配置:

-dontwarn com.igexin.** -keep class com.igexin.** { *; }

然后一切正常了

chenlin05 avatar Jul 02 '20 07:07 chenlin05