Kenny Wan
Feb 23, 2018
8:41 am

AndroidRuntime: java.lang.NoSuchMethodError: No virtual method addPackagesToCertificateWhiteList

Hi,

As the "Migration Guide" says the old class:

android.app.enterprise.SecurityPolicy has been changed to com.samsung.android.knox.keystore.CertificateProvisioning

So I want to use the new knox sdk code in old devices such as in a Knox2.6 device and modified the knoxsdksample code in build.gradle

compile files('libs/supportlib.jar')
compile files('libs/knoxsdk.jar')

and source code

EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(this);
CertificateProvisioning cp = edm.getCertificateProvisioning();

List<AppIdentity> packageList = new ArrayList<AppIdentity>();
packageList.add(new AppIdentity("com.samsung.knoxsdksample", null));
boolean result = cp.addPackagesToCertificateWhiteList(packageList);

 

But I got the crash when running the source code above:

02-23 16:29:14.844 20406 20406 E AndroidRuntime: java.lang.NoSuchMethodError: No virtual method addPackagesToCertificateWhiteList(Ljava/util/List;)Z in class Lcom/samsung/android/knox/keystore/Certifi
cateProvisioning; or its super classes (declaration of 'com.samsung.android.knox.keystore.CertificateProvisioning' appears in /data/app/com.samsung.knoxsdksample-1/base.apk:classes8.dex)
02-23 16:29:14.844 20406 20406 E AndroidRuntime:        at com.samsung.knoxsdksample.MainActivity.ActivateLicence(MainActivity.java:191)
02-23 16:29:14.844 20406 20406 E AndroidRuntime:        at com.samsung.knoxsdksample.MainActivity.access$200(MainActivity.java:64)
02-23 16:29:14.844 20406 20406 E AndroidRuntime:        at com.samsung.knoxsdksample.MainActivity$3.onClick(MainActivity.java:100)
02-23 16:29:14.844 20406 20406 E AndroidRuntime:        at android.view.View.performClick(View.java:5697)
02-23 16:29:14.844 20406 20406 E AndroidRuntime:        at android.widget.TextView.performClick(TextView.java:10816)
02-23 16:29:14.844 20406 20406 E AndroidRuntime:        at android.view.View$PerformClick.run(View.java:22526)
02-23 16:29:14.844 20406 20406 E AndroidRuntime:        at android.os.Handler.handleCallback(Handler.java:739)
02-23 16:29:14.844 20406 20406 E AndroidRuntime:        at android.os.Handler.dispatchMessage(Handler.java:95)
02-23 16:29:14.844 20406 20406 E AndroidRuntime:        at android.os.Looper.loop(Looper.java:158)
02-23 16:29:14.844 20406 20406 E AndroidRuntime:        at android.app.ActivityThread.main(ActivityThread.java:7232)
02-23 16:29:14.844 20406 20406 E AndroidRuntime:        at java.lang.reflect.Method.invoke(Native Method)
02-23 16:29:14.844 20406 20406 E AndroidRuntime:        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
02-23 16:29:14.844 20406 20406 E AndroidRuntime:        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
02-23 16:29:14.854  3390  5399 W ActivityManager:   Force finishing activity com.samsung.knoxsdksample/.MainActivity
02-23 16:29:14.854  3390  5399 W VirtualScreenManagerService: failed to move task TaskRecord{31894b9 #3511 A=com.samsung.knoxsdksample U=0 sz=1}

 

So my question is: shouldn't the supportlib transfer the "CertificateProvisioning" to "SecurityPolicy" in the old knox device?

Thanks!

Zheng

 

 

Kenny Wan
Feb 23, 2018
8:48 am

Hi, Never mind, the "Migration Guilde" says the answer, please ignore, sorry. Zheng