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

Class not found when starting vpnconfiguration #151

Closed
LyraGhost opened this issue Nov 5, 2018 · 15 comments
Closed

Class not found when starting vpnconfiguration #151

LyraGhost opened this issue Nov 5, 2018 · 15 comments
Labels

Comments

@LyraGhost
Copy link

Attempting to get this working, running on Windows 7 and Samsung galaxy s7, android version 8.0.0

Was getting the broadcast completed: result=0 and was looking through other issues on here and was looking through my adb logcat and found the following (attached full logcat.txt too):

11-05 10:16:04.482 24493 24493 D GnirehtetControlReceiver: Received request com.genymobile.gnirehtet.START
11-05 10:16:04.482 24493 24493 D VpnService: prepare function with android vpn context is called for non knox vpn profile
11-05 10:16:04.485  3642  5311 D ConnectivityService: prepare is called by 10976
11-05 10:16:04.486 24493 24493 W GnirehtetControlReceiver: VPN requires the authorization from the user, requesting...
11-05 10:16:04.493  3642  5311 E Parcel  : Class not found when unmarshalling: com.genymobile.gnirehtet.VpnConfiguration
11-05 10:16:04.493  3642  5311 E Parcel  : java.lang.ClassNotFoundException: com.genymobile.gnirehtet.VpnConfiguration
11-05 10:16:04.493  3642  5311 E Parcel  : 	at java.lang.Class.classForName(Native Method)
11-05 10:16:04.493  3642  5311 E Parcel  : 	at java.lang.Class.forName(Class.java:453)
11-05 10:16:04.493  3642  5311 E Parcel  : 	at android.os.Parcel.readParcelableCreator(Parcel.java:2835)
11-05 10:16:04.493  3642  5311 E Parcel  : 	at android.os.Parcel.readParcelable(Parcel.java:2789)
11-05 10:16:04.493  3642  5311 E Parcel  : 	at android.os.Parcel.readValue(Parcel.java:2692)
11-05 10:16:04.493  3642  5311 E Parcel  : 	at android.os.Parcel.readArrayMapInternal(Parcel.java:3059)
11-05 10:16:04.493  3642  5311 E Parcel  : 	at android.os.BaseBundle.unparcel(BaseBundle.java:257)
11-05 10:16:04.493  3642  5311 E Parcel  : 	at android.os.BaseBundle.getString(BaseBundle.java:1086)
11-05 10:16:04.493  3642  5311 E Parcel  : 	at android.content.Intent.getStringExtra(Intent.java:7706)
11-05 10:16:04.493  3642  5311 E Parcel  : 	at com.android.server.am.ActivityStarter.startActivity(ActivityStarter.java:468)
11-05 10:16:04.493  3642  5311 E Parcel  : 	at com.android.server.am.ActivityStarter.startActivityLocked(ActivityStarter.java:419)
11-05 10:16:04.493  3642  5311 E Parcel  : 	at com.android.server.am.ActivityStarter.startActivityMayWait(ActivityStarter.java:1308)
11-05 10:16:04.493  3642  5311 E Parcel  : 	at com.android.server.am.ActivityManagerService.startActivityAsUser(ActivityManagerService.java:6045)
11-05 10:16:04.493  3642  5311 E Parcel  : 	at com.android.server.am.ActivityManagerService.startActivity(ActivityManagerService.java:5897)
11-05 10:16:04.493  3642  5311 E Parcel  : 	at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:121)
11-05 10:16:04.493  3642  5311 E Parcel  : 	at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:3873)
11-05 10:16:04.493  3642  5311 E Parcel  : 	at android.os.Binder.execTransact(Binder.java:682)
11-05 10:16:04.493  3642  5311 E Parcel  : Caused by: java.lang.ClassNotFoundException: com.genymobile.gnirehtet.VpnConfiguration
11-05 10:16:04.493  3642  5311 E Parcel  : 	at java.lang.Class.classForName(Native Method)
11-05 10:16:04.493  3642  5311 E Parcel  : 	at java.lang.BootClassLoader.findClass(ClassLoader.java:1355)
11-05 10:16:04.493  3642  5311 E Parcel  : 	at java.lang.BootClassLoader.loadClass(ClassLoader.java:1415)
11-05 10:16:04.493  3642  5311 E Parcel  : 	at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
11-05 10:16:04.493  3642  5311 E Parcel  : 	... 17 more
11-05 10:16:04.493  3642  5311 E Parcel  : Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available
11-05 10:16:04.494  3642  5311 W Bundle  : Failed to parse Bundle, but defusing quietly
11-05 10:16:04.494  3642  5311 W Bundle  : android.os.BadParcelableException: ClassNotFoundException when unmarshalling: com.genymobile.gnirehtet.VpnConfiguration
11-05 10:16:04.494  3642  5311 W Bundle  : 	at android.os.Parcel.readParcelableCreator(Parcel.java:2863)
11-05 10:16:04.494  3642  5311 W Bundle  : 	at android.os.Parcel.readParcelable(Parcel.java:2789)
11-05 10:16:04.494  3642  5311 W Bundle  : 	at android.os.Parcel.readValue(Parcel.java:2692)
11-05 10:16:04.494  3642  5311 W Bundle  : 	at android.os.Parcel.readArrayMapInternal(Parcel.java:3059)
11-05 10:16:04.494  3642  5311 W Bundle  : 	at android.os.BaseBundle.unparcel(BaseBundle.java:257)
11-05 10:16:04.494  3642  5311 W Bundle  : 	at android.os.BaseBundle.getString(BaseBundle.java:1086)
11-05 10:16:04.494  3642  5311 W Bundle  : 	at android.content.Intent.getStringExtra(Intent.java:7706)
11-05 10:16:04.494  3642  5311 W Bundle  : 	at com.android.server.am.ActivityStarter.startActivity(ActivityStarter.java:468)
11-05 10:16:04.494  3642  5311 W Bundle  : 	at com.android.server.am.ActivityStarter.startActivityLocked(ActivityStarter.java:419)
11-05 10:16:04.494  3642  5311 W Bundle  : 	at com.android.server.am.ActivityStarter.startActivityMayWait(ActivityStarter.java:1308)
11-05 10:16:04.494  3642  5311 W Bundle  : 	at com.android.server.am.ActivityManagerService.startActivityAsUser(ActivityManagerService.java:6045)
11-05 10:16:04.494  3642  5311 W Bundle  : 	at com.android.server.am.ActivityManagerService.startActivity(ActivityManagerService.java:5897)
11-05 10:16:04.494  3642  5311 W Bundle  : 	at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:121)
11-05 10:16:04.494  3642  5311 W Bundle  : 	at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:3873)
11-05 10:16:04.494  3642  5311 W Bundle  : 	at android.os.Binder.execTransact(Binder.java:682)
11-05 10:16:04.500  3642  5311 I ActivityManager: START u0 {act=null typ=null flg=0x10000000 cmp=ComponentInfo{com.genymobile.gnirehtet/com.genymobile.gnirehtet.AuthorizationActivity}} from uid 10976
11-05 10:16:04.504  3642  5311 D CustomFrequencyManagerService: acquireDVFSLockLocked : type : DVFS_MIN_LIMIT  frequency : 2600000  uid : 1000  pid : 3642  pkgName : AMS_APP_SWITCH@CPU_MIN@48
11-05 10:16:04.508  3642  5311 D ActivityManagerPerformance: AMP_acquire() APP_SWITCH
11-05 10:16:04.508  3642  4981 D ActivityManagerPerformance: Received MSG_CFMS_HINT_AMS_SWITCH pkgName: com.genymobile.gnirehtet
11-05 10:16:04.509  3642  7336 D TelephonyManager: getAllCellInfo : Caller (PID / UID / TID): 3642 / 1000 / 7336
11-05 10:16:04.514  3642  3642 D MdnieScenarioControlService: Listener Real Multi Window State : false
11-05 10:16:04.515  3642  5136 D ActivityManager: isScaleDownAnimationEnabled() : false
11-05 10:16:04.519  3642  5136 D PersonaManagerService: Current focused persona service handled id set to : 0
11-05 10:16:04.519  3642  5136 D InputDispatcher: Focused application set to: xxxx
11-05 10:16:04.520  3642  5136 D InputDispatcher: Focus left window: 5155
11-05 10:16:04.521  3642  3969 D GameManagerService: handleForegroundChange(). pkgName: com.genymobile.gnirehtet, clsName: com.genymobile.gnirehtet.AuthorizationActivity,FgActivityName:com.genymobile.gnirehtet/.AuthorizationActivity
11-05 10:16:04.521  3642  3969 D GameManagerService: sem_perfomance_mode: 0
11-05 10:16:04.521  3642  3969 D GameManagerService: notifyResumePause(). pkg: com.genymobile.gnirehtet, type: 4, isMinimized: false, isTunableApp: false
11-05 10:16:04.521  3642  3969 D GameManagerService:   notifyResumePause(). unexpected mPrevNotiType: -1
11-05 10:16:04.521  3642  5136 D MARsPolicyManager: onPackageResumedFG pkgName = com.genymobile.gnirehtet, userId = 0
11-05 10:16:04.524  4292  4311 D ProcessObserver_FLP: onForegroundActivities changed, 24493/10976/true

logcat.txt

@rom1v
Copy link
Collaborator

rom1v commented Nov 5, 2018

Hmm, that's very weird. Did you compile it by yourself or did you take the release (which version)?

@LyraGhost
Copy link
Author

LyraGhost commented Nov 5, 2018

I grabbed latest release from here, 2.3, running run win64 version

@rom1v rom1v added the nodialog label Nov 5, 2018
@rom1v
Copy link
Collaborator

rom1v commented Nov 5, 2018

OK, thank you for your stacktrace.

According to stackoverflow, ClassNotFoundException here may happen depending on the ClassLoader used.

Maybe this may fix the problem:

diff --git a/app/src/main/java/com/genymobile/gnirehtet/GnirehtetService.java b/app/src/main/java/com/genymobile/gnirehtet/GnirehtetService.java
index 7e8b716..57ddc20 100644
--- a/app/src/main/java/com/genymobile/gnirehtet/GnirehtetService.java
+++ b/app/src/main/java/com/genymobile/gnirehtet/GnirehtetService.java
@@ -55,6 +55,7 @@ public class GnirehtetService extends VpnService {
 
     public static void start(Context context, VpnConfiguration config) {
         Intent intent = new Intent(context, GnirehtetService.class);
+        intent.setExtrasClassLoader(GnirehtetService.class.getClassLoader());
         intent.setAction(ACTION_START_VPN);
         intent.putExtra(GnirehtetService.EXTRA_VPN_CONFIGURATION, config);
         if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {

@LyraGhost
Copy link
Author

what would i need to do to go about running this change?

@rom1v
Copy link
Collaborator

rom1v commented Nov 5, 2018

gnirehtet.apk

SHA256: 2fe53280e3af495d78cb4edd14e6690d015f34fd47bb0d12ada8431006bc7ca4

@LyraGhost
Copy link
Author

Seems its still running into the same error
logcat.txt

@rom1v
Copy link
Collaborator

rom1v commented Nov 5, 2018

Sorry, I did not precise: you need to reinstall it.

gnirehtet reinstall

(otherwise it will keep the old version)

@LyraGhost
Copy link
Author

I tried reinstall, uninstall and installing again, still outputting same errors

@LyraGhost
Copy link
Author

file.txt

@rom1v
Copy link
Collaborator

rom1v commented Nov 5, 2018

What about:

diff --git a/app/src/main/java/com/genymobile/gnirehtet/GnirehtetControlReceiver.java b/app/src/main/java/com/genymobile/gnirehtet/GnirehtetControlReceiver.java
index 0437951..3b7996a 100644
--- a/app/src/main/java/com/genymobile/gnirehtet/GnirehtetControlReceiver.java
+++ b/app/src/main/java/com/genymobile/gnirehtet/GnirehtetControlReceiver.java
@@ -97,6 +97,7 @@ public class GnirehtetControlReceiver extends BroadcastReceiver {
     private void requestAuthorization(Context context, Intent vpnIntent, VpnConfiguration config) {
         // we must send the intent with startActivityForResult, so we need to send it from an activity
         Intent intent = new Intent(context, AuthorizationActivity.class);
+        intent.setExtrasClassLoader(GnirehtetControlReceiver.class.getClassLoader());
         intent.putExtra(AuthorizationActivity.EXTRA_VPN_INTENT, vpnIntent);
         intent.putExtra(EXTRA_VPN_CONFIGURATION, config);
         intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

gnirehtet.apk

SHA256: 36f86daefd87512aa707d4bef7f2d12d156297017945f5c0eb1db14d4b08ce34

@LyraGhost
Copy link
Author

attempt3.txt

@rom1v
Copy link
Collaborator

rom1v commented Nov 5, 2018

OK, so I don't know what the problem is. I cannot reproduce it on my device.

This intent should be correct (and is correct on many devices), I don't understand why it can't find VpnConfiguration (moreover it's in the same app in the same process). If someone have an idea…

 Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available

At worst, setExtrasClassLoader(), as used here, should fix the problem.

@rom1v
Copy link
Collaborator

rom1v commented Nov 5, 2018

Ah, but with the patch, your logs do not contain the error.

@rom1v
Copy link
Collaborator

rom1v commented Nov 5, 2018

11-05 12:47:07.876  3642  3969 D GameManagerService: handleForegroundChange(). pkgName: com.genymobile.gnirehtet, clsName: com.genymobile.gnirehtet.AuthorizationActivity,FgActivityName:com.genymobile.gnirehtet/.AuthorizationActivity
…
11-05 12:47:07.887  3642  4187 W MultiScreenManagerService: moveTaskBackToDisplayIfNeeded(): root activity or app is null, task=TaskRecord{eb36c3dd0 #376 A=com.genymobile.gnirehtet U=0 StackId=1 sz=2}, rootActivity=null

If you take the v2.3 release, do you reproduce the first error, or get logs like these ones?

@LyraGhost
Copy link
Author

I managed to resolve the issue.
I redownloaded the 2.3 release, and reinstalled the apk.
I had another vpn set up for other stuff on my phone, so i tried removing that and yours started working.
Not sure why the two vpns were conflicting, the other one was turned off, but i guess having it set up at all broke it.

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

No branches or pull requests

2 participants