Kenny Wan
Feb 21, 2018
2:54 am

cannot compile if add both knoxsdk.jar and supportlib.jar in the sample app

Hi,

I downloaded the sample app from https://seap.samsung.com/sample-app/get-started-knox-sdk and based on https://seap.samsung.com/faq/what-supportlibjar-new-samsung-knox-sdk

"If you want apps using the new Samsung Knox SDK to run on devices using any Knox platform version, you must compile it with both supportlib.jar (for backwards compatibility) as well as knoxsdk.jar."

so I add these two libs into the build.gradle

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

and compile then I got the error:

Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/samsung/android/knox/AppIdentity.class

I believe the AppIdentity.class is defined in both libs. But I guess I cannot exclude it since I have to make it work in both old and new devices, right?

how can I solve this? Thanks!

Zheng

 

 

Samuel Goldwax
Feb 21, 2018
5:44 pm

Hi Kheng,

In the build.gradle file, could to change the import type for the supportlib from 'compile' to 'provided' and see if that solves the problem?

Thanks,
Sam

Arief IrwansyahAug 14, 2018 at 9:37 am
Arief Irwansyah
Aug 14, 2018
9:48 am

Hi,

Same issue here. I use the Knox SDK 3.0 on older devices(Knox 2.7) and include the supportlib.jar file.
I use gradle 4.4 and change "compile" with "implementation"

Its giving me another error 

Program type already present: com.samsung.android.knox.AppIdentity
Message{kind=ERROR, text=Program type already present: com.samsung.android.knox.AppIdentity, sources=[Unknown source file], tool name=Optional.of(D8)}

Any workaround suggestions?

Ashutosh Datar
Aug 30, 2018
7:55 am

Hi,

Came across the same error, solved by removing the following line from the "app/build.gradle" file :

    implementation fileTree(include: ['*.jar'], dir: 'libs')

Removing this line will build the project successfully.

Thanks

 

Comments

Successfully, Thx

Arief IrwansyahAug 31, 2018 at 8:17 am
Vanda Cabanova
Oct 12, 2018
7:43 am

Did you add the supportlib as a runtimeOnly library? 
See the tutorial here https://seap.samsung.com/html-docs/knox-migration/Content/migration-upda...

Sumana G.
Apr 01, 2019
2:51 pm

Hi, I am following the migration guide shared by Samsung for backwards compatibility and I see that I always get this error:

D8: Program type already present: com.samsung.android.knox.ControlInfo
:transformDexArchiveWithExternalLibsDexMergerForDevDebugAndroidTest FAILED
:transformDexArchiveWithExternalLibsDexMergerForDevDebugAndroidTest (Thread[Task worker for ':',5,main]) completed. Took 0.165 secs.

I need to use supportlib jar along with Knox 3.x sdk in my project but then I am not able make any progress because of this issue. It would be really helpful if anyone can guide me thru this. I tried using the supportlib jar only at runtime but, still no luck. Please let me know!