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.
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.
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");
}
// Set license
try{
RasterSupport.setLicense(this, 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();
}
//...
}
}
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document