Has anyone tried to run Apache Felix on Android 4.1 oder 4.2 ?
To me, it look as if something has been changed on the android classloader and now it no longer works.
i start apache felix programmatically as follow:
config.put("felix.bootdelegation.implicit", "false");
config.put("felix.service.urlhandlers","false");
...
felix.start();
my bundle is also "dexed" !
I'm getting this error:
03-04 23:38:51.360: W/System.err(1431): org.osgi.framework.BundleException: Activator start error in bundle org.apache.felix.shell.remote [25].
...
03-04 23:38:51.360: W/System.err(1431): at dalvik.system.NativeStart.main(Native Method)
03-04 23:38:51.360: W/System.err(1431): Caused by: java.lang.UnsupportedOperationException: can't load this type of class file
03-04 23:38:51.360: W/System.err(1431): at java.lang.VMClassLoader.defineClass(Native Method)
03-04 23:38:51.360: W/System.err(1431): at java.lang.ClassLoader.defineClass(ClassLoader.java:292)
03-04 23:38:51.360: W/System.err(1431): at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.findClass(BundleWiringImpl.java:2128)
03-04 23:38:51.360: W/System.err(1431): at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1432)
03-04 23:38:51.360: W/System.err(1431): at org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:72)
03-04 23:38:51.360: W/System.err(1431): at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1843)
03-04 23:38:51.360: W/System.err(1431): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
03-04 23:38:51.360: W/System.err(1431): at org.apache.felix.framework.BundleWiringImpl.getClassByDelegation(BundleWiringImpl.java:1317)
03-04 23:38:51.360: W/System.err(1431): at org.apache.felix.framework.Felix.createBundleActivator(Felix.java:4170)
03-04 23:38:51.360: W/System.err(1431): at org.apache.felix.framework.Felix.activateBundle(Felix.java:1972)
03-04 23:38:51.360: W/System.err(1431): ... 15 more
Can somebody confirm that ?
Is their a solution ?
Maybe their is a property that has to be change in apache felix ?!?!
I've added a new comment to the bug report system: https://issues.apache.org/jira/browse/FELIX-3854?focusedCommentId=13594757&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-13594757
Related
I am having issues with my PhoneGap application that has Urban Airship push notifications running. Everything works fine except when closing the app using Android's native task killer (swiping the app off). When the phone is left idle for 30 seconds to a minute I get the error, "Unfortunately, [app] has stopped". I was viewing LogCat and when this error occured I got these errors:
03-04 10:16:30.420: E/EmbeddedLogger(595): App crashed! Process: com.appname.pacakagename
03-04 10:16:30.420: E/EmbeddedLogger(595): App crashed! Package: com.appname.pacakagename v1 (1.1.2)
03-04 10:16:30.420: E/AndroidRuntime(10257): FATAL EXCEPTION: main
03-04 10:16:30.420: E/AndroidRuntime(10257): java.lang.ExceptionInInitializerError
03-04 10:16:30.420: E/AndroidRuntime(10257): at java.lang.Class.newInstanceImpl(Native Method)
03-04 10:16:30.420: E/AndroidRuntime(10257): at java.lang.Class.newInstance(Class.java:1130)
03-04 10:16:30.420: E/AndroidRuntime(10257): at android.app.ActivityThread.handleCreateService(ActivityThread.java:2909)
03-04 10:16:30.420: E/AndroidRuntime(10257): at android.app.ActivityThread.access$1600(ActivityThread.java:162)
03-04 10:16:30.420: E/AndroidRuntime(10257): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1504)
03-04 10:16:30.420: E/AndroidRuntime(10257): at android.os.Handler.dispatchMessage(Handler.java:99)
03-04 10:16:30.420: E/AndroidRuntime(10257): at android.os.Looper.loop(Looper.java:158)
03-04 10:16:30.420: E/AndroidRuntime(10257): at android.app.ActivityThread.main(ActivityThread.java:5789)
03-04 10:16:30.420: E/AndroidRuntime(10257): at java.lang.reflect.Method.invokeNative(Native Method)
03-04 10:16:30.420: E/AndroidRuntime(10257): at java.lang.reflect.Method.invoke(Method.java:525)
03-04 10:16:30.420: E/AndroidRuntime(10257): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1027)
03-04 10:16:30.420: E/AndroidRuntime(10257): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:843)
03-04 10:16:30.420: E/AndroidRuntime(10257): at dalvik.system.NativeStart.main(Native Method)
03-04 10:16:30.420: E/AndroidRuntime(10257): Caused by: java.lang.NullPointerException
03-04 10:16:30.420: E/AndroidRuntime(10257): at com.urbanairship.Preferences.migratePreferencesFromFileToDb(Preferences.java:173)
03-04 10:16:30.420: E/AndroidRuntime(10257): at com.urbanairship.analytics.AnalyticsPreferences.<init>(AnalyticsPreferences.java:32)
03-04 10:16:30.420: E/AndroidRuntime(10257): at com.urbanairship.analytics.EventService.<clinit>(EventService.java:58)
03-04 10:16:30.420: E/AndroidRuntime(10257): ... 13 more
03-04 10:16:30.430: W/asset(595): Copying FileAsset 0x7860b3b0 (zip:/data/app/com.appname.pacakagename-2.apk:/resources.arsc) to buffer size 200924 to make it aligned.
03-04 10:16:30.430: E/EmbeddedLogger(595): Application Label: appname
So from this I can see these lines:
03-04 10:16:30.420: E/AndroidRuntime(10257): Caused by: java.lang.NullPointerException
03-04 10:16:30.420: E/AndroidRuntime(10257): at com.urbanairship.Preferences.migratePreferencesFromFileToDb(Preferences.java:173)
I wasn't sure where to look to debug that error, I ran this:
find ./ -type f -name *Preferences*
But I couldn't find any file called Preferences.java.
The plugin this is referring to is:
https://github.com/urbanairship/phonegap-ua-push
The Android src is here:
https://github.com/urbanairship/phonegap-ua-push/tree/master/src/android
This was solved by upgrading to the latest version of the Urban Airship plugin and my version of PhoneGap.
03-04 11:09:41.524: E/AndroidRuntime(943): FATAL EXCEPTION: main
03-04 11:09:41.524: E/AndroidRuntime(943): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.otobusumnerede/com.otobusumnerede.AyarlarActivity}: java.lang.NullPointerException
03-04 11:09:41.524: E/AndroidRuntime(943): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
03-04 11:09:41.524: E/AndroidRuntime(943): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
03-04 11:09:41.524: E/AndroidRuntime(943): at android.app.ActivityThread.access$600(ActivityThread.java:141)
03-04 11:09:41.524: E/AndroidRuntime(943): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
03-04 11:09:41.524: E/AndroidRuntime(943): at android.os.Handler.dispatchMessage(Handler.java:99)
03-04 11:09:41.524: E/AndroidRuntime(943): at android.os.Looper.loop(Looper.java:137)
03-04 11:09:41.524: E/AndroidRuntime(943): at android.app.ActivityThread.main(ActivityThread.java:5041)
03-04 11:09:41.524: E/AndroidRuntime(943): at java.lang.reflect.Method.invokeNative(Native Method)
03-04 11:09:41.524: E/AndroidRuntime(943): at java.lang.reflect.Method.invoke(Method.java:511)
03-04 11:09:41.524: E/AndroidRuntime(943): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
03-04 11:09:41.524: E/AndroidRuntime(943): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
03-04 11:09:41.524: E/AndroidRuntime(943): at dalvik.system.NativeStart.main(Native Method)
03-04 11:09:41.524: E/AndroidRuntime(943): Caused by: java.lang.NullPointerException
03-04 11:09:41.524: E/AndroidRuntime(943): at com.otobusumnerede.AyarlarActivity.onCreate(AyarlarActivity.java:24)
03-04 11:09:41.524: E/AndroidRuntime(943): at android.app.Activity.performCreate(Activity.java:5104)
03-04 11:09:41.524: E/AndroidRuntime(943): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
03-04 11:09:41.524: E/AndroidRuntime(943): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
03-04 11:09:41.524: E/AndroidRuntime(943): ... 11 more
03-04 11:24:14.452: E/Trace(1311): error opening trace file: No such file or directory (2)
03-04 11:24:44.843: E/AndroidRuntime(1311): FATAL EXCEPTION: main
03-04 11:24:44.843: E/AndroidRuntime(1311): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.otobusumnerede/com.otobusumnerede.AyarlarActivity}: java.lang.NullPointerException
03-04 11:24:44.843: E/AndroidRuntime(1311): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
03-04 11:24:44.843: E/AndroidRuntime(1311): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
03-04 11:24:44.843: E/AndroidRuntime(1311): at android.app.ActivityThread.access$600(ActivityThread.java:141)
03-04 11:24:44.843: E/AndroidRuntime(1311): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
03-04 11:24:44.843: E/AndroidRuntime(1311): at android.os.Handler.dispatchMessage(Handler.java:99)
03-04 11:24:44.843: E/AndroidRuntime(1311): at android.os.Looper.loop(Looper.java:137)
03-04 11:24:44.843: E/AndroidRuntime(1311): at android.app.ActivityThread.main(ActivityThread.java:5041)
03-04 11:24:44.843: E/AndroidRuntime(1311): at java.lang.reflect.Method.invokeNative(Native Method)
03-04 11:24:44.843: E/AndroidRuntime(1311): at java.lang.reflect.Method.invoke(Method.java:511)
03-04 11:24:44.843: E/AndroidRuntime(1311): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
03-04 11:24:44.843: E/AndroidRuntime(1311): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
03-04 11:24:44.843: E/AndroidRuntime(1311): at dalvik.system.NativeStart.main(Native Method)
03-04 11:24:44.843: E/AndroidRuntime(1311): Caused by: java.lang.NullPointerException
03-04 11:24:44.843: E/AndroidRuntime(1311): at com.otobusumnerede.AyarlarActivity.onCreate(AyarlarActivity.java:25)
03-04 11:24:44.843: E/AndroidRuntime(1311): at android.app.Activity.performCreate(Activity.java:5104)
03-04 11:24:44.843: E/AndroidRuntime(1311): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
03-04 11:24:44.843: E/AndroidRuntime(1311): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
03-04 11:24:44.843: E/AndroidRuntime(1311): ... 11 more
If you can copy text from your activity and paste it, or atleast paste line no.25 of your code, its easier to help you.
Going by as it is so early in your activity, check onCreate() first
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.yourlayoutxml);
imageView = (ImageView) findViewById(R.id.yourimageviewid); //just an example
make sure to call setContentView() before any findViewById
check if you have declared, initialized your variables properly
if so, look for a value that could be null
I have created a custom dialog layout. When invoked, the dialog pops up fine. But when I try to set the content inside the dialog using the two lines commented below, it throws an illegal state exception.
private void showCustomDialog(String content){
final Dialog d = new Dialog(this);
d.setContentView(R.layout.spread_info_popup);
d.show();
// TextView contentTv = (TextView) findViewById(R.id.my_dialog_content);
// contentTv.setText(content);
}
What is wrong here ?
Do i need to inflate the layout spread_info_popup before referring to TextView within it with an id of my_dialog_content ?
the Stacktrace:
03-04 15:03:54.690: E/AndroidRuntime(4194): FATAL EXCEPTION: main
03-04 15:03:54.690: E/AndroidRuntime(4194): java.lang.IllegalStateException: Could not execute method of the activity
03-04 15:03:54.690: E/AndroidRuntime(4194): at android.view.View$1.onClick(View.java:3591)
03-04 15:03:54.690: E/AndroidRuntime(4194): at android.view.View.performClick(View.java:4084)
03-04 15:03:54.690: E/AndroidRuntime(4194): at android.view.View$PerformClick.run(View.java:16966)
03-04 15:03:54.690: E/AndroidRuntime(4194): at android.os.Handler.handleCallback(Handler.java:615)
03-04 15:03:54.690: E/AndroidRuntime(4194): at android.os.Handler.dispatchMessage(Handler.java:92)
03-04 15:03:54.690: E/AndroidRuntime(4194): at android.os.Looper.loop(Looper.java:137)
03-04 15:03:54.690: E/AndroidRuntime(4194): at android.app.ActivityThread.main(ActivityThread.java:4745)
03-04 15:03:54.690: E/AndroidRuntime(4194): at java.lang.reflect.Method.invokeNative(Native Method)
03-04 15:03:54.690: E/AndroidRuntime(4194): at java.lang.reflect.Method.invoke(Method.java:511)
03-04 15:03:54.690: E/AndroidRuntime(4194): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
03-04 15:03:54.690: E/AndroidRuntime(4194): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
03-04 15:03:54.690: E/AndroidRuntime(4194): at dalvik.system.NativeStart.main(Native Method)
03-04 15:03:54.690: E/AndroidRuntime(4194): Caused by: java.lang.reflect.InvocationTargetException
03-04 15:03:54.690: E/AndroidRuntime(4194): at java.lang.reflect.Method.invokeNative(Native Method)
03-04 15:03:54.690: E/AndroidRuntime(4194): at java.lang.reflect.Method.invoke(Method.java:511)
03-04 15:03:54.690: E/AndroidRuntime(4194): at android.view.View$1.onClick(View.java:3586)
03-04 15:03:54.690: E/AndroidRuntime(4194): ... 11 more
03-04 15:03:54.690: E/AndroidRuntime(4194): Caused by: java.lang.NullPointerException
03-04 15:03:54.690: E/AndroidRuntime(4194): at com.me.reader.ui.activity.CompleteList.showSpreadInfoPopup(CompleteList.java:122)
03-04 15:03:54.690: E/AndroidRuntime(4194): at com.me.reader.ui.activity.CompleteList.setSpreadDescriptionfromXML(CompleteList.java:104)
03-04 15:03:54.690: E/AndroidRuntime(4194): at com.me.reader.ui.activity.CompleteList.onAboutIconClicked(CompleteList.java:81)
03-04 15:03:54.690: E/AndroidRuntime(4194): ... 14 more
you should look for the view inside the Dialog:
TextView contentTv = (TextView) dialog.findViewById(R.id.my_dialog_content);
contentTv.setText(content);
here the documentation.
I'm developing a dictionary app for Android and want to use the CWAC LoaderEx library to handle the SQL grunt work. My loader initializes just fine (it populates a listView with the SQL statement I specified in onCreateLoader), but I can't figure out how to reset the loader to run another query with the user's search term.
I tried running execSQL() in onQueryTextChange to initiate a search on each character the user enters:
loader.execSQL(sqlStatement, new String[] { query + "%" });
But the app crashes with the following error:
03-04 12:10:36.310: E/AndroidRuntime(15293): FATAL EXCEPTION: AsyncTask #4
03-04 12:10:36.310: E/AndroidRuntime(15293): java.lang.RuntimeException: An error occured while executing doInBackground()
03-04 12:10:36.310: E/AndroidRuntime(15293): at android.os.AsyncTask$3.done(AsyncTask.java:299)
03-04 12:10:36.310: E/AndroidRuntime(15293): at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:352)
03-04 12:10:36.310: E/AndroidRuntime(15293): at java.util.concurrent.FutureTask.setException(FutureTask.java:219)
03-04 12:10:36.310: E/AndroidRuntime(15293): at java.util.concurrent.FutureTask.run(FutureTask.java:239)
03-04 12:10:36.310: E/AndroidRuntime(15293): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
03-04 12:10:36.310: E/AndroidRuntime(15293): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
03-04 12:10:36.310: E/AndroidRuntime(15293): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
03-04 12:10:36.310: E/AndroidRuntime(15293): at java.lang.Thread.run(Thread.java:856)
* 03-04 12:10:36.310: E/AndroidRuntime(15293): Caused by: android.database.sqlite.SQLiteException: unknown error (code 0): Queries can be performed using SQLiteDatabase query or rawQuery methods only.
03-04 12:10:36.310: E/AndroidRuntime(15293): at android.database.sqlite.SQLiteConnection.nativeExecuteForChangedRowCount(Native Method)
03-04 12:10:36.310: E/AndroidRuntime(15293): at android.database.sqlite.SQLiteConnection.executeForChangedRowCount(SQLiteConnection.java:727)
03-04 12:10:36.310: E/AndroidRuntime(15293): at android.database.sqlite.SQLiteSession.executeForChangedRowCount(SQLiteSession.java:754)
03-04 12:10:36.310: E/AndroidRuntime(15293): at android.database.sqlite.SQLiteStatement.executeUpdateDelete(SQLiteStatement.java:64)
03-04 12:10:36.310: E/AndroidRuntime(15293): at android.database.sqlite.SQLiteDatabase.executeSql(SQLiteDatabase.java:1665)
03-04 12:10:36.310: E/AndroidRuntime(15293): at android.database.sqlite.SQLiteDatabase.execSQL(SQLiteDatabase.java:1644)
03-04 12:10:36.310: E/AndroidRuntime(15293): at com.commonsware.cwac.loaderex.SQLiteCursorLoader$ExecSQLTask.doInBackground(SQLiteCursorLoader.java:188)
03-04 12:10:36.310: E/AndroidRuntime(15293): at com.commonsware.cwac.loaderex.SQLiteCursorLoader$ExecSQLTask.doInBackground(SQLiteCursorLoader.java:1)
03-04 12:10:36.310: E/AndroidRuntime(15293): at android.os.AsyncTask$2.call(AsyncTask.java:287)
03-04 12:10:36.310: E/AndroidRuntime(15293): at java.util.concurrent.FutureTask.run(FutureTask.java:234)
03-04 12:10:36.310: E/AndroidRuntime(15293): ... 4 more
According to the LoaderEx docs, I should be able to use execSQL in this manner to reuse an existing SQLiteCursorLoader. Did I misinterpret the documentation? What am I doing wrong?
Your SQL statement apparently returns a result set. That is not allowed with execSQL() on a SQLiteDatabase. This has nothing to do with SQLiteCursorLoader.
This question already has an answer here:
Joda Time in Eclipse: NoClassDefFoundError
(1 answer)
Closed 9 years ago.
I want to get the current date and time by means of DateTime Class ,I have download Joda from http://sourceforge.net/projects/joda-time/files/joda-time/
and I added three jar files which are in the extracted folder to java build path of my project properties.and my code is like the following code:
import org.joda.time.DateTime;
public class TappedNFC extends Activity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_tapped_nfc);
Button BeamButton=(Button)findViewById(R.id.BeamButton);
BeamButton.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
DateTime dt = new DateTime();
int month = dt.getMonthOfYear();
TextView tx=(TextView)findViewById(R.id.textView1);
tx.setText(Integer.toString(month));
}
});
}
but the logcat gets exception:
03-04 14:57:18.309: E/AndroidRuntime(540): FATAL EXCEPTION: main
03-04 14:57:18.309: E/AndroidRuntime(540): java.lang.NoClassDefFoundError: org.joda.time.DateTime
03-04 14:57:18.309: E/AndroidRuntime(540): at com.example.tappednfc.TappedNFC$1.onClick(TappedNFC.java:28)
03-04 14:57:18.309: E/AndroidRuntime(540): at android.view.View.performClick(View.java:3460)
03-04 14:57:18.309: E/AndroidRuntime(540): at android.view.View$PerformClick.run(View.java:13955)
03-04 14:57:18.309: E/AndroidRuntime(540): at android.os.Handler.handleCallback(Handler.java:605)
03-04 14:57:18.309: E/AndroidRuntime(540): at android.os.Handler.dispatchMessage(Handler.java:92)
03-04 14:57:18.309: E/AndroidRuntime(540): at android.os.Looper.loop(Looper.java:137)
03-04 14:57:18.309: E/AndroidRuntime(540): at android.app.ActivityThread.main(ActivityThread.java:4340)
03-04 14:57:18.309: E/AndroidRuntime(540): at java.lang.reflect.Method.invokeNative(Native Method)
03-04 14:57:18.309: E/AndroidRuntime(540): at java.lang.reflect.Method.invoke(Method.java:511)
03-04 14:57:18.309: E/AndroidRuntime(540): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
03-04 14:57:18.309: E/AndroidRuntime(540): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
03-04 14:57:18.309: E/AndroidRuntime(540): at dalvik.system.NativeStart.main(Native Method)
I haven't used Joda before,So please help me to solve this problem.
Thanks a lot.
When you say you added them to your build path did you use the normal (but incorrect for Android) route of "Properties" > "Java Build Path" > "Add External Jars" ? The correct way to bundle external jars in your Android project is to create a "libs" (note the plural) directory and directly paste them under the directory.
A project build will then show your dependent jars under "Android Dependencies" and they will be bundled correctly into the APK. If you don't follow that route then the external jars are not added and you'll see the sorts of exceptions you noted.