app crash when try to combine mp4 videos - android

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

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.

Crash when trying to use DirectionalViewPager (by Jake Wharton)

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.

Zbar : startPreview failed in galaxy S3

I have used ZBAR library to scan bar code in my Application.
And I got this error log while opening camera on Samsung Galaxy S3 :
java.lang.RuntimeException: startPreview failed
at android.hardware.Camera.startPreview(Native Method)
at com.SGID.MainApp.ScanningFragment.engageCamera(ScanningFragment.java:184)
at com.SGID.MainApp.ScanningFragment.access$10(ScanningFragment.java:154)
at com.SGID.MainApp.ScanningFragment$4.run(ScanningFragment.java:111)
at android.os.Handler.handleCallback(Handler.java:615)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4898)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1006)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773)
at dalvik.system.NativeStart.main(Native Method)
java.lang.RuntimeException: Unable to start activity ComponentInfo
{com.SGID.MainApp/com.SGID.MainApp.AllTabsActivity}
: java.lang.NullPointerException
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2100)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2125)
at android.app.ActivityThread.access$600(ActivityThread.java:140)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1227)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4898)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1006)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException
at com.SGID.MainApp.ParametersFragment.onCreateView(ParametersFragment.java:78)
at android.support.v4.app.Fragment.performCreateView(Fragment.java:1478)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:927)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1104)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1086)
at android.support.v4.app.FragmentManagerImpl.dispatchActivityCreated(FragmentManager.java:1877)
at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:552)
at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1167)
at android.app.Activity.performStart(Activity.java:5216)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2073)
... 11 more
EDIT :
Getting error at this line :
CameraPreview mPreview = new CameraPreview(getActivity(), mCamera, previewCb,
autoFocusCB);
Can Anyone help me to resolve this error??
Thanks in advance..

Having issues integrating Scandit SDK into my app

Decided to use Scandit SDK to get the barcode scanning feature in my app. Unfortunately, since I'm relatively new to Android development and Java in general I've run into a few issues that I can't seem to work out. The demo that Scandit provided doesn't give any errors(runs fine) but crashes when I try to start it up (pressing a button from one activity is meant to start it up). I've tried reading the logcat and googling a solution to the problems but I'm not getting the right solutions. Does anyone have an idea of what I'm doing wrong?
Logcat is provided below:
10-08 23:30:00.807 21563-21563/com.kwesimbia.management D/AndroidRuntime? Shutting down VM
10-08 23:30:00.807 21563-21563/com.kwesimbia.management W/dalvikvm? threadid=1: thread exiting with uncaught exception (group=0x40aa4228)
10-08 23:30:00.817 21563-21563/com.kwesimbia.management E/AndroidRuntime? FATAL EXCEPTION: main
java.lang.IllegalStateException: Could not execute method of the activity
at android.view.View$1.onClick(View.java:3082)
at android.view.View.performClick(View.java:3549)
at android.view.View$PerformClick.run(View.java:14393)
at android.os.Handler.handleCallback(Handler.java:605)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:4944)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at android.view.View$1.onClick(View.java:3077)
at android.view.View.performClick(View.java:3549)
at android.view.View$PerformClick.run(View.java:14393)
at android.os.Handler.handleCallback(Handler.java:605)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:4944)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NoClassDefFoundError: com.kwesimbia.management.ScanditSDKDemoSimple
at com.kwesimbia.management.Activity_D.initiateCodeScan(Activity_D.java:63)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at android.view.View$1.onClick(View.java:3077)
at android.view.View.performClick(View.java:3549)
at android.view.View$PerformClick.run(View.java:14393)
at android.os.Handler.handleCallback(Handler.java:605)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:4944)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
at dalvik.system.NativeStart.main(Native Method)
10-08 23:30:00.817 32726-587/? E/EmbeddedLogger? App crashed!
Process: com.kwesimbia.management
10-08 23:30:00.817 32726-587/? E/EmbeddedLogger? App crashed!
Package: com.kwesimbia.management v1 (1.0)
10-08 23:30:00.817 32726-587/? E/EmbeddedLogger?
Application Label: firstapp
10-08 23:30:00.827 32726-587/? W/ActivityManager?
Force finishing activity com.kwesimbia.management/.Activity_D
I came across this problem as well, my solution was to extract the library files and put them as their files in the lib folder
The library basically isn't being exported with it
EDIT
So I checked out my project, basically I did these things:
In the libs folder I have a new folder called armeabi and inside that I have libscanditsdk-android-3.3.1.so
Then in my build path I have also referenced the jar file that they provide:
<classpathentry exported="true" kind="lib" path="C:/GIT/Android/FwayScannerProject/FwayScanner/libs/scanditsdk-barcodepicker-android-3.3.1.jar"/>

Categories

Resources