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.
3. Finally, 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.
Java:
public class MainActivity extends AppCompatActivity {
private final String TAG = "MyTag";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// Get shared libraries path for APK
String sharedLibsPath = "";
if (Build.VERSION.SDK_INT < 9)
sharedLibsPath = String.format("%s/lib/", this.getApplicationInfo().dataDir);
else
sharedLibsPath = this.getApplicationInfo().nativeLibraryDir;
// Load LEADTOOLS native libraries
try {
Platform.setLibPath(sharedLibsPath);
Platform.loadLibrary(LTLibrary.LEADTOOLS);
}
catch (Exception ex) {
Log.d(TAG, "Failed to load LEADTOOLS native libraries");
}
// Initialize and set license
try{
RasterSupport.initialize(this);
RasterSupport.setLicense(getResources().openRawResource(R.raw.leadtools), "your_dev_key_goes_here");
}
catch(Exception ex){
Log.d(TAG, "Failed to set LEADTOOLS license");
finish();
}
// Ensure that the LEADTOOLS kernel is not expired
if(RasterSupport.getKernelExpired()){
Log.d(TAG, "LEADTOOLS kernel is expired");
finish();
}
//...
}
}
See Also
Products |
Support |
Feedback: Setting your license with LEADTOOLS for Android Studio project |
Introduction |
Help Version 19.0.2017.6.21
|
Raster .NET | C API | C++ Class Library | JavaScript HTML5
Document .NET | C API | C++ Class Library | JavaScript HTML5
Medical .NET | C API | C++ Class Library | JavaScript HTML5
Medical Web Viewer .NET
Your email has been sent to support! Someone should be in touch! If your matter is urgent please come back into chat.
Chat Hours:
Monday - Friday, 8:30am to 6pm ET
Thank you for your feedback!
Please fill out the form again to start a new chat.
All agents are currently offline.
Chat Hours:
Monday - Friday
8:30AM - 6PM EST
To contact us please fill out this form and we will contact you via email.