Crash when trying to use DirectionalViewPager (by Jake Wharton) - android

I looked through all questions on stack overflow with similar problem, but haven't managed to find solution, that suites my case.
I need to implement following structure:
Fragment A is being replaced with fragment B. Fragment B contains ViewPager, that switches fragments C1 and C2. This works great if I use ViewPager from support library, but the problem is, that I need a ViewPager to use vertical swipe. For that purpose I'm using library by Jake Wharton from here https://stackoverflow.com/a/14268702/1220743.
Some code:
A is being replaced by B
Fragment fragment = new FragmentB();
String tag = this.getClass().getName();
FragmentManager fm = getFragmentManager();
fm.beginTransaction().replace(R.id.container, fragment).addToBackStack(tag).commit();
B initializes DirectionalViewPager
DirectionalViewPager viewPager = (DirectionalViewPager)v.findViewById(R.id.view_pager);
FragmentManager fm = getFragmentManager();
viewPager.setAdapter(new MyViewPagerAdapter(fm));
This gives me crash when A switches to B, with following crash stack:
08-18 16:47:02.320: E/AndroidRuntime(29610): FATAL EXCEPTION: main
08-18 16:47:02.320: E/AndroidRuntime(29610): java.lang.IllegalStateException: Recursive entry to executePendingTransactions
08-18 16:47:02.320: E/AndroidRuntime(29610): at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1450)
08-18 16:47:02.320: E/AndroidRuntime(29610): at android.support.v4.app.FragmentManagerImpl.executePendingTransactions(FragmentManager.java:478)
08-18 16:47:02.320: E/AndroidRuntime(29610): at android.support.v4.app.FragmentStatePagerAdapter.finishUpdate(FragmentStatePagerAdapter.java:163)
08-18 16:47:02.320: E/AndroidRuntime(29610): at android.support.v4.view.DirectionalViewPager.populate(DirectionalViewPager.java:399)
08-18 16:47:02.320: E/AndroidRuntime(29610): at android.support.v4.view.DirectionalViewPager.onAttachedToWindow(DirectionalViewPager.java:550)
08-18 16:47:02.320: E/AndroidRuntime(29610): at android.view.View.dispatchAttachedToWindow(View.java:13029)
08-18 16:47:02.320: E/AndroidRuntime(29610): at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2683)
08-18 16:47:02.320: E/AndroidRuntime(29610): at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2690)
08-18 16:47:02.320: E/AndroidRuntime(29610): at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2690)
08-18 16:47:02.320: E/AndroidRuntime(29610): at android.view.ViewGroup.addViewInner(ViewGroup.java:3778)
08-18 16:47:02.320: E/AndroidRuntime(29610): at android.view.ViewGroup.addView(ViewGroup.java:3610)
08-18 16:47:02.320: E/AndroidRuntime(29610): at android.view.ViewGroup.addView(ViewGroup.java:3555)
08-18 16:47:02.320: E/AndroidRuntime(29610): at android.view.ViewGroup.addView(ViewGroup.java:3531)
08-18 16:47:02.320: E/AndroidRuntime(29610): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:949)
08-18 16:47:02.320: E/AndroidRuntime(29610): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1115)
08-18 16:47:02.320: E/AndroidRuntime(29610): at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:682)
08-18 16:47:02.320: E/AndroidRuntime(29610): at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1478)
08-18 16:47:02.320: E/AndroidRuntime(29610): at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:446)
08-18 16:47:02.320: E/AndroidRuntime(29610): at android.os.Handler.handleCallback(Handler.java:730)
08-18 16:47:02.320: E/AndroidRuntime(29610): at android.os.Handler.dispatchMessage(Handler.java:92)
08-18 16:47:02.320: E/AndroidRuntime(29610): at android.os.Looper.loop(Looper.java:176)
08-18 16:47:02.320: E/AndroidRuntime(29610): at android.app.ActivityThread.main(ActivityThread.java:5419)
08-18 16:47:02.320: E/AndroidRuntime(29610): at java.lang.reflect.Method.invokeNative(Native Method)
08-18 16:47:02.320: E/AndroidRuntime(29610): at java.lang.reflect.Method.invoke(Method.java:525)
08-18 16:47:02.320: E/AndroidRuntime(29610): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1046)
08-18 16:47:02.320: E/AndroidRuntime(29610): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:862)
08-18 16:47:02.320: E/AndroidRuntime(29610): at dalvik.system.NativeStart.main(Native Method)
Has anyone faced similar problems?

Did you ever find the solution to this? are the two fragments already in a fragment? if so use getChildFragmentManager() whats curious to me is that getFragmentManager makes it look like you are not using support v4 or it would be getSupportFragmentManager no? but by the log, it seems the error is happening when you use the support lib.

Related

Android Chronotmeter onChronometerTick stackoverflowerror?

I am writting a code in Android to develop a Chronometer app. But i am facing some of the error while i am trying to reset the Chronometer on certain time.
MyCode:
mChronometer.setBase(SystemClock.elapsedRealtime() - 86396000);
mChronometer.start();
mChronometer.setOnChronometerTickListener(new Chronometer.OnChronometerTickListener()
{
#Override
public void onChronometerTick(Chronometer chronometer)
{
long myElapsedMillis = SystemClock.elapsedRealtime() - chronometer.getBase();
if(myElapsedMillis>=86400000)
{
chronometer.stop();
chronometer.setBase(0);
chronometer.start();
}
}
} );
Error:
08-18 02:30:16.793: E/AndroidRuntime(23075): FATAL EXCEPTION: main
08-18 02:30:16.793: E/AndroidRuntime(23075): java.lang.StackOverflowError
08-18 02:30:16.793: E/AndroidRuntime(23075): at android.graphics.Paint.getTextRunAdvances(Paint.java:1845)
08-18 02:30:16.793: E/AndroidRuntime(23075): at android.graphics.Paint.getTextRunAdvances(Paint.java:1818)
08-18 02:30:16.793: E/AndroidRuntime(23075): at android.text.TextLine.handleText(TextLine.java:755)
08-18 02:30:16.793: E/AndroidRuntime(23075): at android.text.TextLine.handleRun(TextLine.java:907)
08-18 02:30:16.793: E/AndroidRuntime(23075): at android.text.TextLine.measureRun(TextLine.java:414)
08-18 02:30:16.793: E/AndroidRuntime(23075): at android.text.TextLine.measure(TextLine.java:293)
08-18 02:30:16.793: E/AndroidRuntime(23075): at android.text.TextLine.metrics(TextLine.java:267)
08-18 02:30:16.793: E/AndroidRuntime(23075): at android.text.BoringLayout.isBoring(BoringLayout.java:308)
08-18 02:30:16.793: E/AndroidRuntime(23075): at android.widget.TextView.makeSingleLayout(TextView.java:6025)
08-18 02:30:16.793: E/AndroidRuntime(23075): at android.widget.TextView.makeNewLayout(TextView.java:5917)
08-18 02:30:16.793: E/AndroidRuntime(23075): at android.widget.TextView.checkForRelayout(TextView.java:6501)
08-18 02:30:16.793: E/AndroidRuntime(23075): at android.widget.TextView.setText(TextView.java:3729)
08-18 02:30:16.793: E/AndroidRuntime(23075): at android.widget.TextView.setText(TextView.java:3587)
08-18 02:30:16.793: E/AndroidRuntime(23075): at android.widget.TextView.setText(TextView.java:3562)
08-18 02:30:16.793: E/AndroidRuntime(23075): at android.widget.Chronometer.updateText(Chronometer.java:250)
08-18 02:30:16.793: E/AndroidRuntime(23075): at android.widget.Chronometer.updateRunning(Chronometer.java:257)
08-18 02:30:16.793: E/AndroidRuntime(23075): at android.widget.Chronometer.start(Chronometer.java:188)
08-18 02:30:16.793: E/AndroidRuntime(23075): at com.example.androidchronometer.MainActivity$1.onChronometerTick(MainActivity.java:46)
08-18 02:30:16.793: E/AndroidRuntime(23075): at android.widget.Chronometer.dispatchChronometerTick(Chronometer.java:279)
08-18 02:30:16.793: E/AndroidRuntime(23075): at android.widget.Chronometer.updateRunning(Chronometer.java:258)
08-18 02:30:16.793: E/AndroidRuntime(23075): at android.widget.Chronometer.start(Chronometer.java:188)
08-18 02:30:16.793: E/AndroidRuntime(23075): at com.example.androidchronometer.MainActivity$1.onChronometerTick(MainActivity.java:46)
08-18 02:30:16.793: E/AndroidRuntime(23075): at android.widget.Chronometer.dispatchChronometerTick(Chronometer.java:279)
08-18 02:30:16.793: E/AndroidRuntime(23075): at android.widget.Chronometer.updateRunning(Chronometer.java:258)
08-18 02:30:16.793: E/AndroidRuntime(23075): at android.widget.Chronometer.start(Chronometer.java:188)
08-18 02:30:16.793: E/AndroidRuntime(23075): at com.example.androidchronometer.MainActivity$1.onChronometerTick(MainActivity.java:46)
08-18 02:30:16.793: E/AndroidRuntime(23075): at android.widget.Chronometer.dispatchChronometerTick(Chronometer.java:279)
08-18 02:30:16.793: E/AndroidRuntime(23075): at android.widget.Chronometer.updateRunning(Chronometer.java:258)
08-18 02:30:16.793: E/AndroidRuntime(23075): at android.widget.Chronometer.start(Chronometer.java:188)
08-18 02:30:16.793: E/AndroidRuntime(23075): at com.example.androidchronometer.MainActivity$1.onChronometerTick(MainActivity.java:46)
08-18 02:30:16.793: E/AndroidRuntime(23075): at android.widget.Chronometer.dispatchChronometerTick(Chronometer.java:279)
08-18 02:30:16.793: E/AndroidRuntime(23075): at android.widget.Chronometer.updateRunning(Chronometer.java:258)
08-18 02:30:16.793: E/AndroidRuntime(23075): at android.widget.Chronometer.start(Chronometer.java:188)
08-18 02:30:16.793: E/AndroidRuntime(23075): at com.example.androidchronometer.MainActivity$1.onChronometerTick(MainActivity.java:46)
08-18 02:30:16.793: E/AndroidRuntime(23075): at android.widget.Chronometer.dispatchChronometerTick(Chronometer.java:279)
08-18 02:30:16.793: E/AndroidRuntime(23075): at android.widget.Chronometer.updateRunning(Chronometer.java:258)
08-18 02:30:16.793: E/AndroidRuntime(23075): at android.widget.Chronometer.start(Chronometer.java:188)
08-18 02:30:16.793: E/AndroidRuntime(23075): at com.example.androidchronometer.MainActivity$1.onChronometerTick(MainActivity.java:46)
08-18 02:30:16.793: E/AndroidRuntime(23075): at android.widget.Chronometer.dispatchChronometerTick(Chronometer.java:279)
08-18 02:30:16.793: E/AndroidRuntime(23075): at android.widget.Chronometer.updateRunning(Chronometer.java:258)
08-18 02:30:16.793: E/AndroidRuntime(23075): at android.widget.Chronometer.start(Chronometer.java:188)
08-18 02:30:16.793: E/AndroidRuntime(23075): at com.example.androidchronometer.MainActivity$1.onChronometerTick(MainActivity.java:46)
08-18 02:30:16.793: E/AndroidRuntime(23075): at android.widget.Chronometer.dispatchChronometerTick(Chronometer.java:279)
08-18 02:30:16.793: E/AndroidRuntime(23075): at android.widget.Chronometer.updateRunning(Chronometer.java:258)
08-18 02:30:16.793: E/AndroidRuntime(23075): at android.widget.Chronometer.start(Chronometer.java:188)
08-18 02:30:16.793: E/AndroidRuntime(23075): at com.example.androidchronometer.MainActivity$1.onChronometerTick(MainActivity.java:46)
08-18 02:30:16.793: E/AndroidRuntime(23075): at android.widget.Chronometer.dispatchChronometerTick(Chronometer.java:279)
08-18 02:30:16.793: E/AndroidRuntime(23075): at android.widget.Chronometer.updateRunning(Chronometer.java:258)
08-18 02:30:16.793: E/AndroidRuntime(23075): at android.widget.Chronometer.start(Chronometer.java:188)
08-18 02:30:16.793: E/AndroidRuntime(23075): at com.example.androidchronometer.MainActivity$1.onChronometerTick(MainActivity.java:46)
08-18 02:30:16.793: E/AndroidRuntime(23075): at android.widget.Chronometer.dispatchChronometerTick(Chronometer.java:279)
08-18 02:30:16.793: E/AndroidRuntime(23075): at android.widget.Chronometer.updateRunning(Chronometer.java:258)
08-18 02:30:16.793: E/AndroidRuntime(23075): at android.widget.Chronometer.start(Chronometer.java:188)
08-18 02:30:16.793: E/AndroidRuntime(23075): at com.example.androidchronometer.MainActivity$1.onChronometerTick(MainActivity.java:46)
08-18 02:30:16.793: E/AndroidRuntime(23075): at android.widget.Chronometer.dispatchChronometerTick(Chronometer.java:279)
08-18 02:30:16.793: E/AndroidRuntime(23075): at android.widget.Chronometer.updateRunning(Chronometer.java:258)
08-18 02:30:16.793: E/AndroidRuntime(23075): at android.widget.Chronometer.start(Chronometer.java:188)
08-18 02:30:16.793: E/AndroidRuntime(23075): at com.example.androidchronometer.MainActivity$1.onChronometerTick
I am facing the StackOverFlowError , while i am trying reset the chronometer on certain time.
Please let me know , how can i get rid of this error , please suggest me what could be the possible solution for this problem.
Set the base to SystemClock.elapsedRealtime() instead of 0:
public void onChronometerTick(Chronometer chronometer)
{
// ...
chronometer.setBase(SystemClock.elapsedRealtime());
chronometer.start();
// ...
}

New to android, can't switch between intents [duplicate]

This question already has answers here:
Activity Declaration in AndroidManifest.xml
(6 answers)
Closed 8 years ago.
I have a button, and when it is clicked I'd like to load a new view.
I am using this main activity class
public class MainActivity extends ActionBarActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
public void buttonPressed(View v){
Intent i = new Intent(this, SwitchedActivity.class);
startActivity(i);
}
}
And then I'd like to load this other activity
public class SwitchedActivity extends Activity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_two);
}
}
So what should happen, is I click the button in activity_main.xml, and then it loads the layout from activity_two.xml.
The problem is, when I click the button, the app just crashes.
I get this logcat stack trace:
08-18 11:36:09.078: E/AndroidRuntime(1232): FATAL EXCEPTION: main
08-18 11:36:09.078: E/AndroidRuntime(1232): Process: com.johncorser.myapp, PID: 1232
08-18 11:36:09.078: E/AndroidRuntime(1232): java.lang.IllegalStateException: Could not execute method of the activity
08-18 11:36:09.078: E/AndroidRuntime(1232): at android.view.View$1.onClick(View.java:3823)
08-18 11:36:09.078: E/AndroidRuntime(1232): at android.view.View.performClick(View.java:4438)
08-18 11:36:09.078: E/AndroidRuntime(1232): at android.view.View$PerformClick.run(View.java:18422)
08-18 11:36:09.078: E/AndroidRuntime(1232): at android.os.Handler.handleCallback(Handler.java:733)
08-18 11:36:09.078: E/AndroidRuntime(1232): at android.os.Handler.dispatchMessage(Handler.java:95)
08-18 11:36:09.078: E/AndroidRuntime(1232): at android.os.Looper.loop(Looper.java:136)
08-18 11:36:09.078: E/AndroidRuntime(1232): at android.app.ActivityThread.main(ActivityThread.java:5017)
08-18 11:36:09.078: E/AndroidRuntime(1232): at java.lang.reflect.Method.invokeNative(Native Method)
08-18 11:36:09.078: E/AndroidRuntime(1232): at java.lang.reflect.Method.invoke(Method.java:515)
08-18 11:36:09.078: E/AndroidRuntime(1232): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
08-18 11:36:09.078: E/AndroidRuntime(1232): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
08-18 11:36:09.078: E/AndroidRuntime(1232): at dalvik.system.NativeStart.main(Native Method)
08-18 11:36:09.078: E/AndroidRuntime(1232): Caused by: java.lang.reflect.InvocationTargetException
08-18 11:36:09.078: E/AndroidRuntime(1232): at java.lang.reflect.Method.invokeNative(Native Method)
08-18 11:36:09.078: E/AndroidRuntime(1232): at java.lang.reflect.Method.invoke(Method.java:515)
08-18 11:36:09.078: E/AndroidRuntime(1232): at android.view.View$1.onClick(View.java:3818)
08-18 11:36:09.078: E/AndroidRuntime(1232): ... 11 more
08-18 11:36:09.078: E/AndroidRuntime(1232): Caused by: android.content.ActivityNotFoundException: Unable to find explicit activity class {com.johncorser.myapp/com.johncorser.myapp.SwitchedActivity}; have you declared this activity in your AndroidManifest.xml?
08-18 11:36:09.078: E/AndroidRuntime(1232): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1628)
08-18 11:36:09.078: E/AndroidRuntime(1232): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1424)
08-18 11:36:09.078: E/AndroidRuntime(1232): at android.app.Activity.startActivityForResult(Activity.java:3424)
08-18 11:36:09.078: E/AndroidRuntime(1232): at android.app.Activity.startActivityForResult(Activity.java:3385)
08-18 11:36:09.078: E/AndroidRuntime(1232): at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:839)
08-18 11:36:09.078: E/AndroidRuntime(1232): at android.app.Activity.startActivity(Activity.java:3627)
08-18 11:36:09.078: E/AndroidRuntime(1232): at android.app.Activity.startActivity(Activity.java:3595)
08-18 11:36:09.078: E/AndroidRuntime(1232): at com.johncorser.myapp.MainActivity.buttonPressed(MainActivity.java:40)
08-18 11:36:09.078: E/AndroidRuntime(1232): ... 14 more
Fair warning, I'm probably doing something VERY stupid, I'm new.
The answer lies in your logcat:
08-18 11:36:09.078: E/AndroidRuntime(1232): Caused by: android.content.ActivityNotFoundException: Unable to find explicit activity class {com.johncorser.myapp/com.johncorser.myapp.SwitchedActivity}; have you declared this activity in your AndroidManifest.xml?
So add it to your manifest like so
<activity
android:name="SwitchedActivity"
android:label="Switched">
</activity>
Whenever you add a new activity, be sure to add it to your manifest.
I am pretty certain that you did not declare the second activity in your AndroidManifest.xml file.
You should have in your manifest:
<application ... >
<activity
android:name=".MainActivity"
... >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".SwitchedActivity"
... >
</activity>
...
</application>
Add the second activity to your manifest file. The log you posted clearly states the problem.
Add the following to your manifest:
<activity
android:name=".SwitchedActivity"/>
Please make sure you read the logcats next time or google the logcat message.

app crash when try to combine mp4 videos

I download the latest source code for mp4parser and use this to combine two mp4 files.
When I try to combine two mp4 videos app crashed.
when I run this line of code
MovieCreator.build("mnt/sdcard/CamVideo/0.mp4")
The app crashed with and crash log is
08-11 17:27:49.023: E/AndroidRuntime(24864): FATAL EXCEPTION: main
08-11 17:27:49.023: E/AndroidRuntime(24864): java.lang.ArrayIndexOutOfBoundsException: length=0; index=0
08-11 17:27:49.023: E/AndroidRuntime(24864): at com.googlecode.mp4parser.authoring.samples.DefaultMp4SampleList.<init>(DefaultMp4SampleList.java:52)
08-11 17:27:49.023: E/AndroidRuntime(24864): at com.coremedia.iso.boxes.mdat.SampleList.<init>(SampleList.java:33)
08-11 17:27:49.023: E/AndroidRuntime(24864): at com.googlecode.mp4parser.authoring.Mp4TrackImpl.<init>(Mp4TrackImpl.java:59)
08-11 17:27:49.023: E/AndroidRuntime(24864): at com.googlecode.mp4parser.authoring.container.mp4.MovieCreator.build(MovieCreator.java:58)
08-11 17:27:49.023: E/AndroidRuntime(24864): at com.googlecode.mp4parser.authoring.container.mp4.MovieCreator.build(MovieCreator.java:39)
08-11 17:27:49.023: E/AndroidRuntime(24864): at com.coderzheaven.pack.CustomCameraActivity.MergeVideos(CustomCameraActivity.java:200)
08-11 17:27:49.023: E/AndroidRuntime(24864): at com.coderzheaven.pack.CustomCameraActivity$1.onClick(CustomCameraActivity.java:108)
08-11 17:27:49.023: E/AndroidRuntime(24864): at android.view.View.performClick(View.java:4274)
08-11 17:27:49.023: E/AndroidRuntime(24864): at android.view.View$PerformClick.run(View.java:17357)
08-11 17:27:49.023: E/AndroidRuntime(24864): at android.os.Handler.handleCallback(Handler.java:615)
08-11 17:27:49.023: E/AndroidRuntime(24864): at android.os.Handler.dispatchMessage(Handler.java:92)
08-11 17:27:49.023: E/AndroidRuntime(24864): at android.os.Looper.loop(Looper.java:137)
08-11 17:27:49.023: E/AndroidRuntime(24864): at android.app.ActivityThread.main(ActivityThread.java:4949)
08-11 17:27:49.023: E/AndroidRuntime(24864): at java.lang.reflect.Method.invokeNative(Native Method)
08-11 17:27:49.023: E/AndroidRuntime(24864): at java.lang.reflect.Method.invoke(Method.java:511)
08-11 17:27:49.023: E/AndroidRuntime(24864): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1043)
08-11 17:27:49.023: E/AndroidRuntime(24864): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:810)
08-11 17:27:49.023: E/AndroidRuntime(24864): at dalvik.system.NativeStart.main(Native Method)
I am using the same properties files that is in sample code "isoparser-custom.properties" and "isoparser-default.properties"
I am expecting movie object should build properly. Can anyone tell me what I am doing wrong in this or can send me fully function code that merge two mp4 files.
EDITED:
I download this file "isoparser-1.0.2.jar" from maven project (http://repo1.maven.org/maven2/com/googlecode/mp4parser/isoparser/1.0.2/) and but app crashed with this crash report
08-18 17:32:20.571: E/AndroidRuntime(31446): FATAL EXCEPTION: main
08-18 17:32:20.571: E/AndroidRuntime(31446): java.lang.ExceptionInInitializerError
08-18 17:32:20.571: E/AndroidRuntime(31446): at java.lang.Class.classForName(Native Method)
08-18 17:32:20.571: E/AndroidRuntime(31446): at java.lang.Class.forName(Class.java:217)
08-18 17:32:20.571: E/AndroidRuntime(31446): at java.lang.Class.forName(Class.java:172)
08-18 17:32:20.571: E/AndroidRuntime(31446): at com.coremedia.iso.PropertyBoxParserImpl.createBox(PropertyBoxParserImpl.java:86)
08-18 17:32:20.571: E/AndroidRuntime(31446): at com.coremedia.iso.AbstractBoxParser.parseBox(AbstractBoxParser.java:102)
08-18 17:32:20.571: E/AndroidRuntime(31446): at com.googlecode.mp4parser.BasicContainer.next(BasicContainer.java:155)
08-18 17:32:20.571: E/AndroidRuntime(31446): at com.googlecode.mp4parser.BasicContainer.hasNext(BasicContainer.java:131)
08-18 17:32:20.571: E/AndroidRuntime(31446): at com.googlecode.mp4parser.util.LazyList$1.hasNext(LazyList.java:55)
08-18 17:32:20.571: E/AndroidRuntime(31446): at com.coremedia.iso.IsoFile.getMovieBox(IsoFile.java:109)
08-18 17:32:20.571: E/AndroidRuntime(31446): at com.googlecode.mp4parser.authoring.container.mp4.MovieCreator.build(MovieCreator.java:48)
08-18 17:32:20.571: E/AndroidRuntime(31446): at com.googlecode.mp4parser.authoring.container.mp4.MovieCreator.build(MovieCreator.java:35)
08-18 17:32:20.571: E/AndroidRuntime(31446): at com.coderzheaven.pack.CustomCameraActivity.MergeVideos(CustomCameraActivity.java:200)
08-18 17:32:20.571: E/AndroidRuntime(31446): at com.coderzheaven.pack.CustomCameraActivity$1.onClick(CustomCameraActivity.java:108)
08-18 17:32:20.571: E/AndroidRuntime(31446): at android.view.View.performClick(View.java:3517)
08-18 17:32:20.571: E/AndroidRuntime(31446): at android.view.View$PerformClick.run(View.java:14155)
08-18 17:32:20.571: E/AndroidRuntime(31446): at android.os.Handler.handleCallback(Handler.java:605)
08-18 17:32:20.571: E/AndroidRuntime(31446): at android.os.Handler.dispatchMessage(Handler.java:92)
08-18 17:32:20.571: E/AndroidRuntime(31446): at android.os.Looper.loop(Looper.java:137)
08-18 17:32:20.571: E/AndroidRuntime(31446): at android.app.ActivityThread.main(ActivityThread.java:4666)
08-18 17:32:20.571: E/AndroidRuntime(31446): at java.lang.reflect.Method.invokeNative(Native Method)
08-18 17:32:20.571: E/AndroidRuntime(31446): at java.lang.reflect.Method.invoke(Method.java:511)
08-18 17:32:20.571: E/AndroidRuntime(31446): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:809)
08-18 17:32:20.571: E/AndroidRuntime(31446): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:576)
08-18 17:32:20.571: E/AndroidRuntime(31446): at dalvik.system.NativeStart.main(Native Method)
08-18 17:32:20.571: E/AndroidRuntime(31446): Caused by: java.lang.NoClassDefFoundError: org.aspectj.runtime.reflect.Factory
08-18 17:32:20.571: E/AndroidRuntime(31446): at com.coremedia.iso.boxes.FileTypeBox.ajc$preClinit(FileTypeBox.java:1)
08-18 17:32:20.571: E/AndroidRuntime(31446): at com.coremedia.iso.boxes.FileTypeBox.<clinit>(FileTypeBox.java:1)
08-18 17:32:20.571: E/AndroidRuntime(31446): ... 24 more
you have not invoked the aspectJ compiler/compile time weaving when you were building the mp4parser on your own. Please either use a precompiled version - they are available on maven central - or make sure that you invoke the compile time weaving.
Newer version than on Maven Central are available in Sonatype OSS staging repositories. In the header of the repository tab please select "Nexus Managed Repositories" (instead of User Managed Repositories) and search for mp4parser.
If you do not use a dependency management tool such as maven or gradle please also make sure that you include the AspectJ runtime jar (at the moment version 1.8.0).
Grüße,
Sebastian

Cocos2dx android application runs on emulator but not on device

The project was working just fine last Thursday, then, some sort of Eclipse bug caused the project properties to get all messed up.
After a splitting and frustrating headache, managed to isolate the issue and fix it....on the emulator, running it on the device gives me the original error messages:
07-25 13:01:08.482: E/AndroidRuntime(4273): FATAL EXCEPTION: main
07-25 13:01:08.482: E/AndroidRuntime(4273): java.lang.ExceptionInInitializerError
07-25 13:01:08.482: E/AndroidRuntime(4273): at java.lang.Class.newInstanceImpl(Native Method)
07-25 13:01:08.482: E/AndroidRuntime(4273): at java.lang.Class.newInstance(Class.java:1319)
07-25 13:01:08.482: E/AndroidRuntime(4273): at android.app.Instrumentation.newActivity(Instrumentation.java:1027)
07-25 13:01:08.482: E/AndroidRuntime(4273): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1885)
07-25 13:01:08.482: E/AndroidRuntime(4273): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1995)
07-25 13:01:08.482: E/AndroidRuntime(4273): at android.app.ActivityThread.access$600(ActivityThread.java:128)
07-25 13:01:08.482: E/AndroidRuntime(4273): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1161)
07-25 13:01:08.482: E/AndroidRuntime(4273): at android.os.Handler.dispatchMessage(Handler.java:99)
07-25 13:01:08.482: E/AndroidRuntime(4273): at android.os.Looper.loop(Looper.java:137)
07-25 13:01:08.482: E/AndroidRuntime(4273): at android.app.ActivityThread.main(ActivityThread.java:4514)
07-25 13:01:08.482: E/AndroidRuntime(4273): at java.lang.reflect.Method.invokeNative(Native Method)
07-25 13:01:08.482: E/AndroidRuntime(4273): at java.lang.reflect.Method.invoke(Method.java:511)
07-25 13:01:08.482: E/AndroidRuntime(4273): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790)
07-25 13:01:08.482: E/AndroidRuntime(4273): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
07-25 13:01:08.482: E/AndroidRuntime(4273): at dalvik.system.NativeStart.main(Native Method)
07-25 13:01:08.482: E/AndroidRuntime(4273): Caused by: java.lang.UnsatisfiedLinkError: Couldn't load game: findLibrary returned null
07-25 13:01:08.482: E/AndroidRuntime(4273): at java.lang.Runtime.loadLibrary(Runtime.java:365)
07-25 13:01:08.482: E/AndroidRuntime(4273): at java.lang.System.loadLibrary(System.java:535)
Already tried at least 12 different ways to fix the "Couldn't load game: findLibrary returned null" error to no avail.
UPDATE: Tried using a 4.0 simulator with the exact same results, so it's definitely tied to android version; however, the project was created and is indeed built for Android 4.0 as the minimum.
Any ideas what might be happening and how to fix it?
Thanks for any replies
Most probably your library is not properly generated. Goto ProjectHome->libs->armeabi->libgame.so . libgame.so file is missing.
This file could be generated when you run create-android-project.bat or equivalent linux file.
which creates empty android project.Try copy paste this file from there.
To build cocos2dx project for Android you should perform two steps.
Build C++ libraries. It can be done with build_native.sh
Build Java Project. It can be done through Eclipse.
Such error will happen if you have missed the first step.

Service not Available - Geocoder Android [duplicate]

This question already has answers here:
Why is Android Geocoder throwing a "Service not Available" exception?
(6 answers)
Closed 9 years ago.
I have a little problem with the geocoder to get latitude and lontitude from an address :
This is my code:
for (Garage g : XMLGarage) {
List<Address> address;
address = coder.getFromLocationName(
g.getAddress(), 5);
if (address != null) {
Address location = address.get(0);
g.setLatitude(location.getLatitude());
g.setLongitude(location.getLongitude());
...
The error is :
08-18 14:28:56.026: WARN/System.err(359): java.io.IOException: Service not Available
08-18 14:28:56.026: WARN/System.err(359): at
android.location.Geocoder.getFromLocationName(Geocoder.java:178)
08-18 14:28:56.026: WARN/System.err(359): at
com.amt.android.garage.Garage.postData(Garage.java:269)
08-18 14:28:56.026: WARN/System.err(359): at
com.amt.android.garage.GarageForm$2.onClick(GarageForm.java:86)
08-18 14:28:56.026: WARN/System.err(359): at
android.view.View.performClick(View.java:2485)
08-18 14:28:56.026: WARN/System.err(359): at
android.view.View$PerformClick.run(View.java:9080)
08-18 14:28:56.036: WARN/System.err(359): at
android.os.Handler.handleCallback(Handler.java:587)
08-18 14:28:56.036: WARN/System.err(359): at
android.os.Handler.dispatchMessage(Handler.java:92)
08-18 14:28:56.036: WARN/System.err(359): at
android.os.Looper.loop(Looper.java:130)
08-18 14:28:56.036: WARN/System.err(359): at
android.app.ActivityThread.main(ActivityThread.java:3683)
08-18 14:28:56.036: WARN/System.err(359): at
java.lang.reflect.Method.invokeNative(Native Method)
08-18 14:28:56.036: WARN/System.err(359): at
java.lang.reflect.Method.invoke(Method.java:507)
08-18 14:28:56.036: WARN/System.err(359): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
08-18 14:28:56.046: WARN/System.err(359): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
08-18 14:28:56.046: WARN/System.err(359): at dalvik.system.NativeStart.main(Native
Method)
There is a problem recently with android devices and the geocoder not working:
http://code.google.com/p/android/issues/detail?id=38009
A reboot seems to fix the issue
You will get this error occasionally if the GeoCoding provider fails and is unable to geocode your location.
See these relevant posts:
Geocoder.getFromLocation throws Exception
Geocoder.getFromLocation throws IOException on Android emulator
If this is not the case, make sure you have the Internet permission in your Manifest:
<uses-permission android:name="android.permission.INTERNET" />
Try updating Location first. Like below
locationManager.requestLocationUpdates(bestProvider, 20000, 1, this);
refer to here.

Categories

Resources