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";@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.activity_main);// Get shared libraries path for APKString sharedLibsPath = "";if (Build.VERSION.SDK_INT < 9)sharedLibsPath = String.format("%s/lib/", this.getApplicationInfo().dataDir);elsesharedLibsPath = this.getApplicationInfo().nativeLibraryDir;// Load LEADTOOLS native librariestry {Platform.setLibPath(sharedLibsPath);Platform.loadLibrary(LTLibrary.LEADTOOLS);}catch (Exception ex) {Log.d(TAG, "Failed to load LEADTOOLS native libraries");}// Initialize and set licensetry{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 expiredif(RasterSupport.getKernelExpired()){Log.d(TAG, "LEADTOOLS kernel is expired");finish();}//...}}
See Also
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
