Copy the Chilkat Java Sources into your Android Project

The Chilkat Android download provides the Chilkat classes as Java source files in the com.chilkatsoft package. Place them so their folder path matches the package, and Android Studio compiles them with your app.

Where the source files go

Java source files live under app/src/main/java/ in a folder path that matches their package. The Chilkat classes declare:

package com.chilkatsoft;

So they go in app/src/main/java/com/chilkatsoft/:

app/src/main/java/com/chilkatsoft/
├─ chilkat.java
├─ chilkatJNI.java
├─ CkHttp.java
├─ CkJsonObject.java
└─ ... (all the Ck*.java files)

Steps

  1. Create the package folder

    Under app/src/main/java/, create the folders com/chilkatsoft/ (if they don't already exist).

  2. Copy the source files

    Copy every Chilkat .java file from the download's src/com/chilkatsoft/ into that folder — including chilkat.java and chilkatJNI.java, not just the Ck* classes.

  3. Sync the project

    In Android Studio, right-click the java folder and choose Synchronize (or File → Sync Project) so the IDE picks up the new files.


Also required

The Java sources are only one half of the library. You also need to:
  • Add the native libraries to app/src/main/jniLibs/<abi>/libchilkat.so — see Where to put the Chilkat JNI shared libraries.
  • Load the library with System.loadLibrary("chilkat") before using any Chilkat class.
  • Add the INTERNET permission to your manifest for any networking feature.
See the full walkthrough: Using Chilkat in an Android Studio project.

With a default Android Studio project, jniLibs under src/main/ is recognized automatically — no build.gradle change is needed. Only set sourceSets { main { jniLibs.srcDirs = [...] } } if you keep the libraries in a non-default location.


Use the Chilkat classes

Once the sources are in place (and the native library is loaded), import and use Chilkat like any other class:

import com.chilkatsoft.CkGlobal;
import com.chilkatsoft.CkHttp;

// Unlock once at startup (any string starts the 30-day trial).
CkGlobal glob = new CkGlobal();
glob.UnlockBundle("Anything for 30-day trial");

CkHttp http = new CkHttp();
// ... use Chilkat methods

← Back to Chilkat for Android