Can not access com.codename1.impl.android.AndroidNativeUtil From nativeInterface in codenameone as this structure is not available in the CodenameOne.jar. Do I need to import any other jar in classpath? Need to access the activity of codenameOne from the native interface by the below code:
private static Activity activity() {
return com.codename1.impl.android.AndroidNativeUtil.getActivity();
}
But I am getting this error while deploying:
Compiling with JDK Java compiler API.
/tmp/build313004297852547361xxx/MyApplication/src/main/java/com/mycompany/myapp/MyNativeImpl.java:46: error: cannot find symbol
private static Activity activity() {
^
symbol: class Activity
location: class MyNativeImpl /tmp/build313004297852547361xxx/MyApplication/src/main/java/com/codename1/impl/android/AndroidImplementation.java:4684: error: cannot find symbol if (android.support.v4.content.ContextCompat.checkSelfPermission(activity, ^ symbol: method checkSelfPermission(CodenameOneActivity,String) location: class ContextCompat /tmp/build313004297852547361xxx/MyApplication/src/main/java/com/codename1/impl/android/AndroidImplementation.java:7117: error: cannot find symbol if (android.support.v4.content.ContextCompat.checkSelfPermission(activity, ^ symbol: method checkSelfPermission(CodenameOneActivity,String) location: class ContextCompat /tmp/build313004297852547361xxx/MyApplication/src/main/java/com/codename1/impl/android/AndroidImplementation.java:7122: error: cannot find symbol if (!forceAsk && android.support.v4.app.ActivityCompat.shouldShowRequestPermissionRationale(activity, ^ symbol: method shouldShowRequestPermissionRationale(CodenameOneActivity,String) location: class ActivityCompat /tmp/build313004297852547361xxx/MyApplication/src/main/java/com/codename1/impl/android/AndroidImplementation.java:7135: error: cannot find symbol android.support.v4.app.ActivityCompat.requestPermissions(activity, ^ symbol: method requestPermissions(CodenameOneActivity,String[],int) location: class ActivityCompat /tmp/build313004297852547361xxx/MyApplication/src/main/java/com/codename1/impl/android/AndroidImplementation.java:7152: error: cannot find symbol return android.support.v4.content.ContextCompat.checkSelfPermission(activity, ^ symbol: method checkSelfPermission(CodenameOneActivity,String) location: class ContextCompat /tmp/build313004297852547361xxx/MyApplication/src/main/java/com/mycompany/myapp/MyNativeImpl.java:56: error: no suitable constructor found for Intent(MyNativeImpl,Class) Intent intent = new Intent(this, ^ constructor Intent.Intent(String,Uri) is not applicable (argument mismatch; MyNativeImpl cannot be converted to String) constructor Intent.Intent(Context,Class) is not applicable (argument mismatch; MyNativeImpl cannot be converted to Context)