Welcome Guest! To enable all features, please Login or Register.



Last Go to last post Unread Go to first unread post
#1 Posted : Friday, April 21, 2017 1:08:21 PM(UTC)


Groups: Registered, Tech Support, Administrators
Posts: 39

Thanks: 2 times
Was thanked: 3 time(s) in 3 post(s)

One of the more common issues we see in the support queue are issues with setting a license. This post will focus on the Android mobile platform and setting a license there. You can reference additional information regarding setting a license in this FAQ post: https://www.leadtools.com/support/forum/posts/t12112-How-do-I-set-an-evaluation-or-purchased-imaging-license


1. First, you will need to place the LEADTOOLS kernel as well as your license file in your Android Studio project. In your application's module, place leadtools.jar from /Bin/Java into the /libs folder. Create a /src/main/jniLibs folder, and then create a subfolder for the CPU architectures that you wish to support. In this example, we are supporting armeabi-v7a only. Place the appropriate version of libleadtools.so from /Bin/Android/ into this folder. Then, rename your license file such that it only contains lowercase letters. Create a /src/main/res/raw folder in your module and place the license file there.
add android license

2. Ensure that you are compiling leadtools.jar from the /libs folder. Open your module's build.gradle file and place one of the following lines in the 'dependencies' block. You can opt to compile all .jar files in the /libs folder, or compile individual files.
compile dependencies

3. Lastly, you will need to set your license at runtime. Here is an example on how to do so in onCreate() of your startup Activity. Be sure to replace "your_dev_key_goes_here" with your actual development key.
public class MainActivity extends AppCompatActivity { 
    private final String TAG = "MyTag"; 
    protected void onCreate(Bundle savedInstanceState) { 
        // Get shared libraries path for APK 
        String sharedLibsPath = ""; 
        if (Build.VERSION.SDK_INT < 9) 
            sharedLibsPath = String.format("%s/lib/", this.getApplicationInfo().dataDir); 
            sharedLibsPath = this.getApplicationInfo().nativeLibraryDir; 
        // Load LEADTOOLS native libraries 
        try { 
        catch (Exception ex) { 
            Log.d(TAG, "Failed to load LEADTOOLS native libraries"); 
        // Initialize and set license 
            RasterSupport.setLicense(getResources().openRawResource(R.raw.leadtools), "your_dev_key_goes_here"); 
        catch(Exception ex){ 
            Log.d(TAG, "Failed to set LEADTOOLS license"); 
        // Ensure that the LEADTOOLS kernel is not expired 
            Log.d(TAG, "LEADTOOLS kernel is expired"); 

Edited by moderator Monday, February 3, 2020 8:32:48 AM(UTC)  | Reason: Not specified

Roberto Rodriguez
Developer Support Engineer
LEAD Technologies, Inc.


Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2023, Yet Another Forum.NET
This page was generated in 0.047 seconds.