I'm currently trying to use the OpenMobile API which is library built-in in the android. (and not available for every device).
I'm following this tutorial to add the library to my android sdk : https://github.com/seek-for-android/pool/wiki/UsingSmartCardAPI
I have added the OpenMobile API through the SDK Manager and I now have folders in the path-to-sdk/sdk/add-ons. I'm currently using the last version of android (25) in Android Studio, and the OpenMobileAPI files located in sdk/add-ons are available for the version 21. There is no library available above 21 (see http://seek-for-android.github.io/repository/21/addon.xml).
Manifest :
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
<application android:label="@string/app_name">
<uses-library android:name="org.simalliance.openmobileapi" android:required="true" />
<activity android:name=".MainActivity">
...
</activity>
</application>
</manifest>
MainActivity
import org.simalliance.openmobileapi.*;
public class MainActivity extends Activity implements SEService.CallBack {
...
public void serviceConnected(SEService service) {
Log.i(LOG_TAG, "seviceConnected()");
}
}
It's written :
Build SDK: Open Mobile API (Giesecke & Devrient GmbH) (API 21)
org.simalliance is not recognised by Android Studio, so I can't use it.
How do I build the SDK so that the library class are available in Android Studio ?
Inside the Android app gradle :
compile fileTree(include: ['*.jar'], dir: 'libs', 'exclude': ['org.simalliance.openmobileapi.jar'])
provided files('libs/org.simalliance.openmobileapi.jar')
Manifest : In application tag add :
<uses-library android:name="org.simalliance.openmobileapi" android:required="false" />
The provided instead of compile allow the library to be recognized and used in the code but is not compiled in the apk during the build.