無法訪問com.codename1.impl.android.AndroidNativeUtil來自codenameone中的nativeInterface,因爲此結構在CodenameOne.jar中不可用。 我是否需要在類路徑中導入任何其他jar?需要通過下面的代碼從本機接口訪問codenameOne的活動:無法訪問com.codename1.impl.android.AndroidNativeUtil來自nativeInterface
private static Activity activity() {
return com.codename1.impl.android.AndroidNativeUtil.getActivity();
}
但是,同時部署我收到此錯誤:
與JDK Java編譯器API編譯。
/tmp/build313004297852547361xxx/MyApplication/src/main/java/com/mycompany/myapp/MyNativeImpl.java:46: error: cannot find symbol
private static Activity activity() {
^
symbol: class Activity
位置:類MyNativeImpl /tmp/build313004297852547361xxx/MyApplication/src/main/java/com/codename1/impl/android/AndroidImplementation.java:4684:錯誤:如果(android.support找不到符號 .v4.content.ContextCompat.checkSelfPermission(活性, ^ 符號:方法checkSelfPermission(CodenameOneActivity,字符串) 位置:類ContextCompat /TMP/build313004297852547361xxx /所有MyApplication/SRC /主/ JAVA/COM/codename1/IMPL /機器人/ AndroidImplementation.java:7117:錯誤:無法找到符號 if(android.support.v4.content.ContextCompat.checkSelfP ermission(活性, ^ 符號:方法checkSelfPermission(CodenameOneActivity,字符串) 位置:類ContextCompat /tmp/build313004297852547361xxx/MyApplication/src/main/java/com/codename1/impl/android/AndroidImplementation.java:7122:錯誤:找不到符號 如果(forceAsk & & android.support.v4.app.ActivityCompat.shouldShowRequestPermissionRationale(活動, ^ 符號:方法shouldShowRequestPermissionRationale(CodenameOneActivity,字符串) 位置:類ActivityCompat 的/ tmp/build313004297852547361xxx /所有MyApplication/src/main/java/com/codename1/impl/android/AndroidImplementation.java:7135:error:can not find sy MBOL android.support.v4.app.ActivityCompat.requestPermissions(活性, ^ 符號:方法requestPermissions(CodenameOneActivity,字符串[],INT) 位置:類ActivityCompat /TMP/build313004297852547361xxx /所有MyApplication/SRC /主/ JAVA /com/codename1/impl/android/AndroidImplementation.java:7152:錯誤:無法找到符號 返回android.support.v4.content.ContextCompat.checkSelfPermission(活動, ^ 符號:方法checkSelfPermission(CodenameOneActivity,字符串) 位置:class ContextCompat /tmp/build313004297852547361xxx/MyApplication/src/main/java/com/mycompany/myapp/MyNativeImpl.java:56:錯誤:沒有找到合適的構造函數Intent(My NativeImpl,Class) Intent intent = new Intent(this, ^ 構造函數Intent.Intent(String,Uri)不適用 (參數不匹配; MyNativeImpl不能轉換爲String) 構造Intent.Intent(上下文,類)是不適用 (參數不匹配; MyNativeImpl不能轉換爲上下文)
你能分享你的codenameone_settings.properties嗎? – Chen