Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error 'Unable to load class named [io.jsonwebtoken.impl.DefaultJwtParser]' #10

Closed
JunjaK opened this issue Dec 20, 2019 · 13 comments
Closed
Assignees

Comments

@JunjaK
Copy link

JunjaK commented Dec 20, 2019

Is it a security issue?

May be no...

What happened actually?

Actually, in flutter debug mode, It works well. but when I install my flutter app in my device with release mode of flutter, Gets error like this.

PlatformException(INTERNAL_ERROR, java.io.IOException: org.json.JSONException: Unable to load class named [io.jsonwebtoken.impl.DefaultJwtParser] from the thread context, current, or system/application ClassLoaders.  All heuristics have been exhausted.  Class could not be found.
I/flutter (26210):      at c.d.c.c.a.d.a(:2)
I/flutter (26210):      at c.d.c.c.a.a.a.a(:45)
I/flutter (26210):      at c.d.c.c.a.a.a.b(:19)
I/flutter (26210):      at com.linecorp.linesdk.auth.internal.c$a.a(:22)
I/flutter (26210):      at com.linecorp.linesdk.auth.internal.c$a.doInBackground(:1)
I/flutter (26210):      at android.os.AsyncTask$2.call(AsyncTask.java:333)
I/flutter (26210):      at java.util.concurrent.FutureTask.run(FutureTask.java:266)
I/flutter (26210):      at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:245)
I/flutter (26210):      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
I/flutter (26210):      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
I/flutter (26210):      at java.lang.Thread.run(Thread.java:764)
I/flutter (26210): Caused by: org.json.JSONException: Unable to load class named [io.jsonwebtoken.impl.DefaultJwtParser] from the thread context, current, or system/application ClassLoaders

Authorization menu works well like this.

Screenshot_20191220-160654_LINE

How can I solve this problem??
(I already tried this issue. line/line-sdk-android#7, may be nothing to do with this issue... )

  • my proguard code is
-keep class io.flutter.app.** { *; }
-keep class io.flutter.plugin.**  { *; }
-keep class io.flutter.util.**  { *; }
-keep class io.flutter.view.**  { *; }
-keep class io.flutter.**  { *; }
-keep class io.flutter.plugins.**  { *; }
-keep class org.spongycastle.** { *; }
-keep class io.jsonwebtoken.** { *; }
-dontwarn org.spongycastle.**
-dontwarn io.flutter.embedding.**
-dontwarn android.**
-dontwarn com.squareup.picasso.**

Your environment?

in release mode
Android 9.0
Galaxy s10e(SM-G970N)
in debug mode
emulator pixel2 and, 3, Andorid sdk version 28, Window10

@onevcat
Copy link
Member

onevcat commented Dec 20, 2019

I guess it is related to some pro guard rules. @plateaukao Can you look at it when you have time?

@JunjaK JunjaK changed the title error 'Unable to load class named [io.jsonwebtoken.impl.DefaultJwtParser]' error 'Unable to load class named [io.jsonwebtoken.impl.DefaultJwtParser]' fix( full error text ) Dec 20, 2019
@JunjaK JunjaK changed the title error 'Unable to load class named [io.jsonwebtoken.impl.DefaultJwtParser]' fix( full error text ) error 'Unable to load class named [io.jsonwebtoken.impl.DefaultJwtParser]' Dec 20, 2019
@JunjaK
Copy link
Author

JunjaK commented Dec 20, 2019

May be It concerned with scope of 'openid' ( json web token )
When I run line sign in with no scope, It works well.
But when I run line sign in with scope ["profile", "openid", "email"], turns out error like above.
test
However I applied openid in line developer.
So I don't know how to solve this problem ..

(This case also release mode, debug mode works well everything.)

@plateaukao
Copy link
Member

Hi, @JunjaK
The fix is under review now. #11
Hope the pull request can fix the proguard issue in release version.

@plateaukao plateaukao self-assigned this Dec 24, 2019
@JunjaK
Copy link
Author

JunjaK commented Dec 24, 2019

Thanks for your help.
I'll check if new version of line sdk is released on pub.dev.

@JunjaK JunjaK closed this as completed Dec 24, 2019
@onevcat
Copy link
Member

onevcat commented Dec 25, 2019

Version 1.2.3 was released for this issue. Thank you for reporting!

@JunjaK
Copy link
Author

JunjaK commented Dec 25, 2019

Thanks!!
It works well.
But there is still something to ask,
There is difference between debug mode data and release mode data (result of line social login)
In debug mode, the result data of line social login is same as this repository's doc.
But in release mode, the result data of line social login is something different.
(This issue also applies to previous versions. 1.2.1(I only tested this version))
Example is like this.

{
 b: 
  {
    access_token: raw string of access token(private), 
    expires_in: 2592000000, 
    id_token: 
      {
        "a": raw string of id token(private), 
        "b": "https://access.line.me",
        "c":  some token(private),
        "d": audience(private) ,
        "e":"Dec 26, 2019 4:18:50 AM",
        "f":"Dec 26, 2019 3:18:50 AM",
        "h": some token(private),
        "i":["lineautologin"], 
        "j":"윤준현(じゅん jun)", 
        "k": profile url(private)
        "m" : email string(private)
      }, 
    }
  c: "profile openid" 
}

Some '(private)' texts are string that leaks my information. so I can't paste it here.
Anyway, in release mode, I can't access result.userprofile, result.acesstoken. I can only access data above in debug mode.

This is just report of the result.
It really works well after update 1.2.3 version.
I just want report data differences between release mode and debug mode

@onevcat
Copy link
Member

onevcat commented Dec 26, 2019

I think this should be finally fixed in 1.2.4.

@JunjaK
Copy link
Author

JunjaK commented Dec 26, 2019

What happened actually?

After I Updated line sdk 1.2.4, I got error.
These are errors when I run code 'flutter build appbundle' same as release mode.
In debug mode, Everything is okay.

e: C:\Flutter\.pub-cache\hosted\pub.dartlang.org\flutter_line_sdk-1.2.4\android\src\main\kotlin\com\linecorp\flutter_line_sdk\model\AccessToken.kt: (3, 24): Unresolved reference: annotation
e: C:\Flutter\.pub-cache\hosted\pub.dartlang.org\flutter_line_sdk-1.2.4\android\src\main\kotlin\com\linecorp\flutter_line_sdk\model\AccessToken.kt: (9, 2): Unresolved reference: Keep
e: C:\Flutter\.pub-cache\hosted\pub.dartlang.org\flutter_line_sdk-1.2.4\android\src\main\kotlin\com\linecorp\flutter_line_sdk\model\BotFriendshipStatus.kt: (3, 24): Unresolved reference: annotation
e: C:\Flutter\.pub-cache\hosted\pub.dartlang.org\flutter_line_sdk-1.2.4\android\src\main\kotlin\com\linecorp\flutter_line_sdk\model\BotFriendshipStatus.kt: (6, 2): Unresolved reference: Keep
e: C:\Flutter\.pub-cache\hosted\pub.dartlang.org\flutter_line_sdk-1.2.4\android\src\main\kotlin\com\linecorp\flutter_line_sdk\model\Error.kt: (3, 24): Unresolved reference: annotation
e: C:\Flutter\.pub-cache\hosted\pub.dartlang.org\flutter_line_sdk-1.2.4\android\src\main\kotlin\com\linecorp\flutter_line_sdk\model\Error.kt: (6, 2): Unresolved reference: Keep
e: C:\Flutter\.pub-cache\hosted\pub.dartlang.org\flutter_line_sdk-1.2.4\android\src\main\kotlin\com\linecorp\flutter_line_sdk\model\LoginResultForFlutter.kt: (3, 24): Unresolved reference: annotation
e: C:\Flutter\.pub-cache\hosted\pub.dartlang.org\flutter_line_sdk-1.2.4\android\src\main\kotlin\com\linecorp\flutter_line_sdk\model\LoginResultForFlutter.kt: (8, 2): Unresolved reference: Keep
e: C:\Flutter\.pub-cache\hosted\pub.dartlang.org\flutter_line_sdk-1.2.4\android\src\main\kotlin\com\linecorp\flutter_line_sdk\model\UserProfile.kt: (3, 24): Unresolved reference: annotation
e: C:\Flutter\.pub-cache\hosted\pub.dartlang.org\flutter_line_sdk-1.2.4\android\src\main\kotlin\com\linecorp\flutter_line_sdk\model\UserProfile.kt: (6, 2): Unresolved reference: Keep
e: C:\Flutter\.pub-cache\hosted\pub.dartlang.org\flutter_line_sdk-1.2.4\android\src\main\kotlin\com\linecorp\flutter_line_sdk\model\VerifyAccessTokenResult.kt: (3, 24): Unresolved reference: annotation
e: C:\Flutter\.pub-cache\hosted\pub.dartlang.org\flutter_line_sdk-1.2.4\android\src\main\kotlin\com\linecorp\flutter_line_sdk\model\VerifyAccessTokenResult.kt: (6, 2): Unresolved reference: Keep

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':flutter_line_sdk:compileReleaseKotlin'.
> Compilation error. See log for more details

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 1m 0s
Running Gradle task 'assembleRelease'...
Running Gradle task 'assembleRelease'... Done                      61.5s
Gradle task assembleRelease failed with exit code 1

Your Environment

use line sdk 1.2.4
In debug mode : android sdk 28 (pixel2, 3)
In release mode : andorid 9.0 Galaxy s10e(SM-G970N

@JunjaK JunjaK reopened this Dec 26, 2019
@plateaukao
Copy link
Member

plateaukao commented Dec 26, 2019

@JunjaK do you use AndroidX for your flutter android project?

Currently, line-sdk-android and also flutter_line_sdk still uses android support library instead of AndroidX library.

Could you let me know your flutter development environment?

I tried to migrate the plugin to androidx library.

Could you help to try out this pull request? #13

@JunjaK
Copy link
Author

JunjaK commented Dec 26, 2019

@plateaukao
Okay.
What exactly should I do to complete pull request #13 ?

I am using AndroidX in my flutter project and
the result of flutter doctor is this

$ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel beta, v1.12.13+hotfix.6, on Microsoft Windows [Version 10.0.18363.535], locale    ko-KR)

[√] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
[√] Android Studio (version 3.5)
[√] VS Code (version 1.41.1)

and
my pubspec.ymal is this

name: nuwbies_event
description: A new Flutter project.

environment:
  sdk: ">=2.1.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter
  flutter_line_sdk: ^1.2.4
  
dev_dependencies:
  flutter_test:
    sdk: flutter

module:
  androidX: true

Is there anything else I need to tell you?
Because I'm newbie of flutter, so I don't know much of flutter.

@JunjaK
Copy link
Author

JunjaK commented Dec 26, 2019

Plus, There is something to correct.
The same error occurs in debug mode.
The error details are as follows.

e: C:\Flutter\.pub-cache\hosted\pub.dartlang.org\flutter_line_sdk-1.2.4\android\src\main\kotlin\com\linecorp\flutter_line_sdk\model\AccessToken.kt: (3, 24): Unresolved reference: annotation
e: C:\Flutter\.pub-cache\hosted\pub.dartlang.org\flutter_line_sdk-1.2.4\android\src\main\kotlin\com\linecorp\flutter_line_sdk\model\AccessToken.kt: (9, 2): Unresolved reference: Keep
e: C:\Flutter\.pub-cache\hosted\pub.dartlang.org\flutter_line_sdk-1.2.4\android\src\main\kotlin\com\linecorp\flutter_line_sdk\model\BotFriendshipStatus.kt: (3, 24): Unresolved reference: annotation
e: C:\Flutter\.pub-cache\hosted\pub.dartlang.org\flutter_line_sdk-1.2.4\android\src\main\kotlin\com\linecorp\flutter_line_sdk\model\BotFriendshipStatus.kt: (6, 2): Unresolved reference: Keep
e: C:\Flutter\.pub-cache\hosted\pub.dartlang.org\flutter_line_sdk-1.2.4\android\src\main\kotlin\com\linecorp\flutter_line_sdk\model\Error.kt: (3, 24): Unresolved reference: annotation
e: C:\Flutter\.pub-cache\hosted\pub.dartlang.org\flutter_line_sdk-1.2.4\android\src\main\kotlin\com\linecorp\flutter_line_sdk\model\Error.kt: (6, 2): Unresolved reference: Keep
e: C:\Flutter\.pub-cache\hosted\pub.dartlang.org\flutter_line_sdk-1.2.4\android\src\main\kotlin\com\linecorp\flutter_line_sdk\model\LoginResultForFlutter.kt: (3, 24): Unresolved reference: annotation
e: C:\Flutter\.pub-cache\hosted\pub.dartlang.org\flutter_line_sdk-1.2.4\android\src\main\kotlin\com\linecorp\flutter_line_sdk\model\LoginResultForFlutter.kt: (8, 2): Unresolved reference: Keep
e: C:\Flutter\.pub-cache\hosted\pub.dartlang.org\flutter_line_sdk-1.2.4\android\src\main\kotlin\com\linecorp\flutter_line_sdk\model\UserProfile.kt: (3, 24): Unresolved reference: annotation
e: C:\Flutter\.pub-cache\hosted\pub.dartlang.org\flutter_line_sdk-1.2.4\android\src\main\kotlin\com\linecorp\flutter_line_sdk\model\UserProfile.kt: (6, 2): Unresolved reference: Keep
e: C:\Flutter\.pub-cache\hosted\pub.dartlang.org\flutter_line_sdk-1.2.4\android\src\main\kotlin\com\linecorp\flutter_line_sdk\model\VerifyAccessTokenResult.kt: (3, 24): Unresolved reference: annotation
e: C:\Flutter\.pub-cache\hosted\pub.dartlang.org\flutter_line_sdk-1.2.4\android\src\main\kotlin\com\linecorp\flutter_line_sdk\model\VerifyAccessTokenResult.kt: (6, 2): Unresolved reference: Keep

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':flutter_line_sdk:compileDebugKotlin'.
> Compilation error. See log for more details

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 28s
Gradle task assembleDebug failed with exit code 1
Exited (sigterm)

Environment is
Window10
emulator - android SDK28 pixel3 / use androidX
flutter version : flutter (Channel beta, v1.12.13+hotfix.6, on Microsoft Windows [Version 10.0.18363.535],

@plateaukao
Copy link
Member

plateaukao commented Dec 27, 2019

I updated a new pull request to remove the failed fix, and still tried to fix the wrong idToken json data in pull request #15.

If possible, please help to fetch pull request #15 , and modify your pubspec.yaml to something similar to following snippet, and try to build your flutter app in release mode again.

...
dependencies:
  flutter:
    sdk: flutter
  #flutter_line_sdk: ^1.2.4
  
dev_dependencies:
  flutter_test:
    sdk: flutter

  flutter_line_sdk:
    path: ../   # <-- change to where you put the flutter_line_sdk project locally

...

@JunjaK
Copy link
Author

JunjaK commented Dec 27, 2019

It works well both in release mode and in debug mode
Thanks.
The Line login data in release mode also same as in debug mode.

My Environment

$ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel beta, v1.12.13+hotfix.6, on Microsoft Windows [Version 10.0.18363.535], locale ko-KR)

[√] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
[√] Android Studio (version 3.5)
[√] VS Code (version 1.41.1)
[√] Connected device (1 available)

In debug mode : android sdk 28 (pixel3)
In release mode : andorid 9.0 Galaxy s10e(SM-G970N

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants