I have complete build for Android Content shell from this link AndroidBuildInstructions.
after that i want to make Eclipse project from it and i follow this link code of Chromium for Android.
But when i add all required java classes and required resource Only issue i am getting now is in Below two aidl file .
1)IRemoteAndroidKeyStoreInterface.aidl It is under Package org.chromium.net,Here is aidl file code:
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
interface org.chomium.net.IRemoteAndroidKeyStore;
interface org.chromium.net.IRemoteAndroidKeyStoreCallbacks;
2)common.aidl It is under Package org.chromium.content.common ,It's code is below
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// This file is needed to compile IChildProcessCallback.aidl and
// IChildProcessServices.aidl into java source files. See
// content/public/android/java/content.xml for target aidl.
interface org.chromium.content.common.IChildProcessCallback;
interface org.chromium.content.common.IChildProcessService;
Both file give me Error like below one :
Multiple markers at this line
- syntax error don't know what to do with ";"
- syntax error
Do any one have complete code of ContentShell apk to make some modification in it as i am unable to make running code to Eclipse .Does any one have idea how to resolved this aidl issue for android content shell source code?
For just try i have remove that two aidl from both package and run project but it now give below Error:
04-08 15:22:56.362: E/ContentShellActivity(10236): ContentView initialization failed.
04-08 15:22:56.362: E/ContentShellActivity(10236): org.chromium.base.library_loader.ProcessInitException
04-08 15:22:56.362: E/ContentShellActivity(10236): at org.chromium.base.library_loader.LibraryLoader.loadAlreadyLocked(LibraryLoader.java:190)
04-08 15:22:56.362: E/ContentShellActivity(10236): at org.chromium.base.library_loader.LibraryLoader.ensureInitialized(LibraryLoader.java:85)
04-08 15:22:56.362: E/ContentShellActivity(10236): at org.chromium.base.library_loader.LibraryLoader.ensureInitialized(LibraryLoader.java:57)
04-08 15:22:56.362: E/ContentShellActivity(10236): at org.chromium.content_shell_apk.ContentShellActivity.onCreate(ContentShellActivity.java:60)
04-08 15:22:56.362: E/ContentShellActivity(10236): at android.app.Activity.performCreate(Activity.java:5231)
04-08 15:22:56.362: E/ContentShellActivity(10236): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
04-08 15:22:56.362: E/ContentShellActivity(10236): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
04-08 15:22:56.362: E/ContentShellActivity(10236): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
04-08 15:22:56.362: E/ContentShellActivity(10236): at android.app.ActivityThread.access$800(ActivityThread.java:135)
04-08 15:22:56.362: E/ContentShellActivity(10236): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
04-08 15:22:56.362: E/ContentShellActivity(10236): at android.os.Handler.dispatchMessage(Handler.java:102)
04-08 15:22:56.362: E/ContentShellActivity(10236): at android.os.Looper.loop(Looper.java:136)
04-08 15:22:56.362: E/ContentShellActivity(10236): at android.app.ActivityThread.main(ActivityThread.java:5017)
04-08 15:22:56.362: E/ContentShellActivity(10236): at java.lang.reflect.Method.invokeNative(Native Method)
04-08 15:22:56.362: E/ContentShellActivity(10236): at java.lang.reflect.Method.invoke(Method.java:515)
04-08 15:22:56.362: E/ContentShellActivity(10236): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
04-08 15:22:56.362: E/ContentShellActivity(10236): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
04-08 15:22:56.362: E/ContentShellActivity(10236): at dalvik.system.NativeStart.main(Native Method)
04-08 15:22:56.362: E/ContentShellActivity(10236): Caused by: java.lang.UnsatisfiedLinkError: unknown failure
04-08 15:22:56.362: E/ContentShellActivity(10236): at java.lang.Runtime.loadLibrary(Runtime.java:364)
04-08 15:22:56.362: E/ContentShellActivity(10236): at java.lang.System.loadLibrary(System.java:526)
04-08 15:22:56.362: E/ContentShellActivity(10236): at org.chromium.base.library_loader.LibraryLoader.loadAlreadyLocked(LibraryLoader.java:161)
04-08 15:22:56.362: E/ContentShellActivity(10236): ... 17 more
Related
04-08 00:46:02.390: D/AndroidRuntime(918): Shutting down VM
04-08 00:46:02.390: W/dalvikvm(918): threadid=1: thread exiting with uncaught exception (group=0xb4acab90)
04-08 00:46:02.420: E/AndroidRuntime(918): FATAL EXCEPTION: main
04-08 00:46:02.420: E/AndroidRuntime(918): Process: net.gnobal.dindy, PID: 918
04-08 00:46:02.420: E/AndroidRuntime(918): java.lang.RuntimeException: Unable to instantiate application net.gnobal.dindy.DindyApplication: java.lang.ClassNotFoundException: Didn't find class "net.gnobal.dindy.DindyApplication" on path: DexPathList[[zip file "/data/app/net.gnobal.dindy-1.apk"],nativeLibraryDirectories=[/data/app-lib/net.gnobal.dindy-1, /system/lib]]
04-08 00:46:02.420: E/AndroidRuntime(918): at android.app.LoadedApk.makeApplication(LoadedApk.java:516)
04-08 00:46:02.420: E/AndroidRuntime(918): at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4298)
04-08 00:46:02.420: E/AndroidRuntime(918): at android.app.ActivityThread.access$1400(ActivityThread.java:135)
04-08 00:46:02.420: E/AndroidRuntime(918): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1457)
04-08 00:46:02.420: E/AndroidRuntime(918): at android.os.Handler.dispatchMessage(Handler.java:102)
04-08 00:46:02.420: E/AndroidRuntime(918): at android.os.Looper.loop(Looper.java:137)
04-08 00:46:02.420: E/AndroidRuntime(918): at android.app.ActivityThread.main(ActivityThread.java:4998)
04-08 00:46:02.420: E/AndroidRuntime(918): at java.lang.reflect.Method.invokeNative(Native Method)
04-08 00:46:02.420: E/AndroidRuntime(918): at java.lang.reflect.Method.invoke(Method.java:515)
04-08 00:46:02.420: E/AndroidRuntime(918): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:777)
04-08 00:46:02.420: E/AndroidRuntime(918): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:593)
04-08 00:46:02.420: E/AndroidRuntime(918): at dalvik.system.NativeStart.main(Native Method)
04-08 00:46:02.420: E/AndroidRuntime(918): Caused by: java.lang.ClassNotFoundException: Didn't find class "net.gnobal.dindy.DindyApplication" on path: DexPathList[[zip file "/data/app/net.gnobal.dindy-1.apk"],nativeLibraryDirectories=[/data/app-lib/net.gnobal.dindy-1, /system/lib]]
04-08 00:46:02.420: E/AndroidRuntime(918): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
04-08 00:46:02.420: E/AndroidRuntime(918): at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
04-08 00:46:02.420: E/AndroidRuntime(918): at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
04-08 00:46:02.420: E/AndroidRuntime(918): at android.app.Instrumentation.newApplication(Instrumentation.java:975)
04-08 00:46:02.420: E/AndroidRuntime(918): at android.app.LoadedApk.makeApplication(LoadedApk.java:511)
04-08 00:46:02.420: E/AndroidRuntime(918): ... 11 more
04-08 00:46:07.430: I/Process(918): Sending signal. PID: 918 SIG: 9
Check your package name and also check whether the class name i.e activity is properly registered in the manifest.
I'm trying to populate a RelativeLayout with multiple elements by using a for loop in which a string array is the changing factor. Errors made me trim this down to a simpler code, which is still giving me trouble. I'm getting a NullPointerException when I try to add the TextView, t.
int addGradeTypesLayoutId = R.id.AddGradeTypesLayout;
TextView t = new TextView(this.getActivity());
RelativeLayout addGradeTypesLayout = (RelativeLayout) this.getActivity().findViewById(addGradeTypesLayoutId);
RelativeLayout.LayoutParams tLayoutParams = new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
tLayoutParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT);;
t.setText("helloooo");
t.setLayoutParams(tLayoutParams);
t.setId(1);
addGradeTypesLayout.addView(t); //Exception here
This code runs within a fragment class in an activity.
Stacktrace as per request:
04-08 20:37:59.235: D/(2413): HostConnection::get() New Host Connection established 0xb84b56b0, tid 2413
04-08 20:37:59.415: W/EGL_emulation(2413): eglSurfaceAttrib not implemented
04-08 20:37:59.425: D/OpenGLRenderer(2413): Enabling debug mode 0
04-08 20:38:16.135: D/dalvikvm(2413): GC_FOR_ALLOC freed 121K, 7% free 3018K/3236K, paused 68ms, total 72ms
04-08 20:38:16.285: D/AndroidRuntime(2413): Shutting down VM
04-08 20:38:16.285: W/dalvikvm(2413): threadid=1: thread exiting with uncaught exception (group=0xb2a9bba8)
04-08 20:38:16.335: E/AndroidRuntime(2413): FATAL EXCEPTION: main
04-08 20:38:16.335: E/AndroidRuntime(2413): Process: com.NsouthProductions.gradetrackerpro, PID: 2413
04-08 20:38:16.335: E/AndroidRuntime(2413): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.NsouthProductions.gradetrackerpro/com.NsouthProductions.gradetrackerpro.AddCourse}: android.view.InflateException: Binary XML file line #7: Error inflating class fragment
04-08 20:38:16.335: E/AndroidRuntime(2413): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195)
04-08 20:38:16.335: E/AndroidRuntime(2413): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
04-08 20:38:16.335: E/AndroidRuntime(2413): at android.app.ActivityThread.access$800(ActivityThread.java:135)
04-08 20:38:16.335: E/AndroidRuntime(2413): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
04-08 20:38:16.335: E/AndroidRuntime(2413): at android.os.Handler.dispatchMessage(Handler.java:102)
04-08 20:38:16.335: E/AndroidRuntime(2413): at android.os.Looper.loop(Looper.java:136)
04-08 20:38:16.335: E/AndroidRuntime(2413): at android.app.ActivityThread.main(ActivityThread.java:5017)
04-08 20:38:16.335: E/AndroidRuntime(2413): at java.lang.reflect.Method.invokeNative(Native Method)
04-08 20:38:16.335: E/AndroidRuntime(2413): at java.lang.reflect.Method.invoke(Method.java:515)
04-08 20:38:16.335: E/AndroidRuntime(2413): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
04-08 20:38:16.335: E/AndroidRuntime(2413): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
04-08 20:38:16.335: E/AndroidRuntime(2413): at dalvik.system.NativeStart.main(Native Method)
04-08 20:38:16.335: E/AndroidRuntime(2413): Caused by: android.view.InflateException: Binary XML file line #7: Error inflating class fragment
04-08 20:38:16.335: E/AndroidRuntime(2413): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:713)
04-08 20:38:16.335: E/AndroidRuntime(2413): at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
04-08 20:38:16.335: E/AndroidRuntime(2413): at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
04-08 20:38:16.335: E/AndroidRuntime(2413): at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
04-08 20:38:16.335: E/AndroidRuntime(2413): at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
04-08 20:38:16.335: E/AndroidRuntime(2413): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:290)
04-08 20:38:16.335: E/AndroidRuntime(2413): at android.app.Activity.setContentView(Activity.java:1929)
04-08 20:38:16.335: E/AndroidRuntime(2413): at android.support.v7.app.ActionBarActivity.superSetContentView(ActionBarActivity.java:216)
04-08 20:38:16.335: E/AndroidRuntime(2413): at android.support.v7.app.ActionBarActivityDelegateICS.setContentView(ActionBarActivityDelegateICS.java:110)
04-08 20:38:16.335: E/AndroidRuntime(2413): at android.support.v7.app.ActionBarActivity.setContentView(ActionBarActivity.java:76)
04-08 20:38:16.335: E/AndroidRuntime(2413): at com.NsouthProductions.gradetrackerpro.AddCourse.onCreate(AddCourse.java:43)
04-08 20:38:16.335: E/AndroidRuntime(2413): at android.app.Activity.performCreate(Activity.java:5231)
04-08 20:38:16.335: E/AndroidRuntime(2413): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
04-08 20:38:16.335: E/AndroidRuntime(2413): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
04-08 20:38:16.335: E/AndroidRuntime(2413): ... 11 more
04-08 20:38:16.335: E/AndroidRuntime(2413): Caused by: java.lang.NullPointerException
04-08 20:38:16.335: E/AndroidRuntime(2413): at com.NsouthProductions.gradetrackerpro.AddCourse$AddCourseFragment.onCreateView(AddCourse.java:184)
04-08 20:38:16.335: E/AndroidRuntime(2413): at android.support.v4.app.Fragment.performCreateView(Fragment.java:1500)
04-08 20:38:16.335: E/AndroidRuntime(2413): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:911)
04-08 20:38:16.335: E/AndroidRuntime(2413): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1093)
04-08 20:38:16.335: E/AndroidRuntime(2413): at android.support.v4.app.FragmentManagerImpl.addFragment(FragmentManager.java:1195)
04-08 20:38:16.335: E/AndroidRuntime(2413): at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:291)
04-08 20:38:16.335: E/AndroidRuntime(2413): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:685)
04-08 20:38:16.335: E/AndroidRuntime(2413): ... 24 more
04-08 20:38:19.565: I/Process(2413): Sending signal. PID: 2413 SIG: 9
ANSWER: My fragment class (where this code runs) has a rootView defined by its layout. The fix was changing to rootView.findViewById(addGradeTypesLayoutId).
Make sure your code called Activity.setContentView() before the code you provided above.
If so, make sure the view or the layout that you passed to setContentView() actually contains a RelativeLayout with a AddGradeTypesLayout ID.
If the snippet is in onCreateView(), you should not assume that the Activity layout is ready for you to add to directly, since onCreateView() is called before the Activity is completely created. Instead, you should: (a) update your layout XML to specify that the fragment is inside the AddGradeTypesLayout RelativeLayout, and (b) have your onCreateView() return the new TextView [instead of calling addView() on the activity's layout object, which could be null]. Here is an example of this approach (look for the TextFragment).
You should use findViewById() to find id of the textView.
i know this question has been treated so much time, but i really don't find the answer to my problem.
This is an application which connect to a server, so, there's a socket, that's why i'm using thread (i can't do anything else since android 4.0), but even if i'm disable the code of my socket, it still crash.
Here's the logCat error :
04-08 08:36:39.366: D/AndroidRuntime(16604): Shutting down VM
04-08 08:36:39.366: W/dalvikvm(16604): threadid=1: thread exiting with uncaught exception (group=0x4122f300)
04-08 08:36:39.366: E/AndroidRuntime(16604): FATAL EXCEPTION: main
04-08 08:36:39.366: E/AndroidRuntime(16604): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.projetlyres2013/com.example.projetlyres2013.PlanDMX}: java.lang.NullPointerException
04-08 08:36:39.366: E/AndroidRuntime(16604): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1983)
04-08 08:36:39.366: E/AndroidRuntime(16604): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
04-08 08:36:39.366: E/AndroidRuntime(16604): at android.app.ActivityThread.access$600(ActivityThread.java:130)
04-08 08:36:39.366: E/AndroidRuntime(16604): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
04-08 08:36:39.366: E/AndroidRuntime(16604): at android.os.Handler.dispatchMessage(Handler.java:99)
04-08 08:36:39.366: E/AndroidRuntime(16604): at android.os.Looper.loop(Looper.java:137)
04-08 08:36:39.366: E/AndroidRuntime(16604): at android.app.ActivityThread.main(ActivityThread.java:4745)
04-08 08:36:39.366: E/AndroidRuntime(16604): at java.lang.reflect.Method.invokeNative(Native Method)
04-08 08:36:39.366: E/AndroidRuntime(16604): at java.lang.reflect.Method.invoke(Method.java:511)
04-08 08:36:39.366: E/AndroidRuntime(16604): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
04-08 08:36:39.366: E/AndroidRuntime(16604): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
04-08 08:36:39.366: E/AndroidRuntime(16604): at dalvik.system.NativeStart.main(Native Method)
04-08 08:36:39.366: E/AndroidRuntime(16604): Caused by: java.lang.NullPointerException
04-08 08:36:39.366: E/AndroidRuntime(16604): at android.app.Activity.findViewById(Activity.java:1825)
04-08 08:36:39.366: E/AndroidRuntime(16604): at com.example.projetlyres2013.PlanDMX.<init>(PlanDMX.java:27)
04-08 08:36:39.366: E/AndroidRuntime(16604): at java.lang.Class.newInstanceImpl(Native Method)
04-08 08:36:39.366: E/AndroidRuntime(16604): at java.lang.Class.newInstance(Class.java:1319)
04-08 08:36:39.366: E/AndroidRuntime(16604): at android.app.Instrumentation.newActivity(Instrumentation.java:1053)
04-08 08:36:39.366: E/AndroidRuntime(16604): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1974)
04-08 08:36:39.366: E/AndroidRuntime(16604): ... 11 more
04-08 08:36:41.326: I/Process(16604): Sending signal. PID: 16604 SIG: 9
04-08 08:46:26.556: D/AndroidRuntime(16825): Shutting down VM
///////// Manifest /////////
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.projetlyres2013"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="16" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.example.projetlyres2013.PlanDMX"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
I don't know what's happened when i want to launch it on my tablet (android 4.1).
I really need help for that :/
Thanks
NullPointer here means that you did not set your layout XML as contentView to your Activity.
Inside onCreate(...) method of Activity add
setContentView(R.layout.some_layout-file)
I have the following code:
Line Code
193 private Camera mCamera;
<!-- NO CALLS TO mCamera HERE -->
229 mCamera = Camera.open();
230 Camera.Parameters p = mCamera.getParameters();
And when I run the application I get the following stacktrace:
04-08 20:56:45.330: E/AndroidRuntime(570): FATAL EXCEPTION: main
04-08 20:56:45.330: E/AndroidRuntime(570): java.lang.NullPointerException
04-08 20:56:45.330: E/AndroidRuntime(570): at com.soloman.cbc.FullscreenActivity$MySurfaceView.surfaceCreated(FullscreenActivity.java:230)
04-08 20:56:45.330: E/AndroidRuntime(570): at android.view.SurfaceView.updateWindow(SurfaceView.java:569)
04-08 20:56:45.330: E/AndroidRuntime(570): at android.view.SurfaceView.access$000(SurfaceView.java:86)
04-08 20:56:45.330: E/AndroidRuntime(570): at android.view.SurfaceView$3.onPreDraw(SurfaceView.java:174)
04-08 20:56:45.330: E/AndroidRuntime(570): at android.view.ViewTreeObserver.dispatchOnPreDraw(ViewTreeObserver.java:680)
04-08 20:56:45.330: E/AndroidRuntime(570): at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1842)
04-08 20:56:45.330: E/AndroidRuntime(570): at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:989)
04-08 20:56:45.330: E/AndroidRuntime(570): at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4351)
04-08 20:56:45.330: E/AndroidRuntime(570): at android.view.Choreographer$CallbackRecord.run(Choreographer.java:749)
04-08 20:56:45.330: E/AndroidRuntime(570): at android.view.Choreographer.doCallbacks(Choreographer.java:562)
04-08 20:56:45.330: E/AndroidRuntime(570): at android.view.Choreographer.doFrame(Choreographer.java:532)
04-08 20:56:45.330: E/AndroidRuntime(570): at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:735)
04-08 20:56:45.330: E/AndroidRuntime(570): at android.os.Handler.handleCallback(Handler.java:725)
04-08 20:56:45.330: E/AndroidRuntime(570): at android.os.Handler.dispatchMessage(Handler.java:92)
04-08 20:56:45.330: E/AndroidRuntime(570): at android.os.Looper.loop(Looper.java:137)
04-08 20:56:45.330: E/AndroidRuntime(570): at android.app.ActivityThread.main(ActivityThread.java:5039)
04-08 20:56:45.330: E/AndroidRuntime(570): at java.lang.reflect.Method.invokeNative(Native Method)
04-08 20:56:45.330: E/AndroidRuntime(570): at java.lang.reflect.Method.invoke(Method.java:511)
04-08 20:56:45.330: E/AndroidRuntime(570): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
04-08 20:56:45.330: E/AndroidRuntime(570): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
04-08 20:56:45.330: E/AndroidRuntime(570): at dalvik.system.NativeStart.main(Native Method)
The code I am using is from How can I manipulate the camera preview?
I have the CAMERA permission in the AndroidManifest.xml, and all imports are accounted for. Does anyone have any suggestions on how to fix this error?
Thank you.
On devices without back-facing camera Camera.open() returns null. Try Camera.open(0) to get front camera.
if the android version is prior to 3.0 use the
getHolder().setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
I am porting my C/C++ code into an Android Game using the NDK, but I'm having trouble getting started.
I have downloaded the NDK-r5b from developer.android.com and I have installed Cygwin.
I am not even able to run the Hello-jni program provided within the NDK samples.
When I run:
$ cd /cygdrive/c/android/android-ndk-r5b/samples/hello-jni
$ ndk-build
I get an ERROR: You are using a non-Cygwin compatible Make program.
I tried installing GNUMake 3.81 but the problem persists.
I tried to run the HELLO-JNI sample program in the NDK through Eclipse IDE. There is a force close on the Android AVD, and logcat was showing an exception as follows:
04-08 12:32:11.609: ERROR/AndroidRuntime(274): FATAL EXCEPTION: main
04-08 12:32:11.609: ERROR/AndroidRuntime(274):
java.lang.ExceptionInInitializerError
04-08 12:32:11.609: ERROR/AndroidRuntime(274): at
java.lang.Class.newInstanceImpl(Native Method)
04-08 12:32:11.609: ERROR/AndroidRuntime(274): at
java.lang.Class.newInstance(Class.java:1429)
04-08 12:32:11.609: ERROR/AndroidRuntime(274): at
android.app.Instrumentation.newActivity(Instrumentation.java:1021)
04-08 12:32:11.609: ERROR/AndroidRuntime(274): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:
2577)
04-08 12:32:11.609: ERROR/AndroidRuntime(274): at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:
2679)
04-08 12:32:11.609: ERROR/AndroidRuntime(274): at
android.app.ActivityThread.access$2300(ActivityThread.java:125)
04-08 12:32:11.609: ERROR/AndroidRuntime(274): at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
04-08 12:32:11.609: ERROR/AndroidRuntime(274): at
android.os.Handler.dispatchMessage(Handler.java:99)
04-08 12:32:11.609: ERROR/AndroidRuntime(274): at
android.os.Looper.loop(Looper.java:123)
04-08 12:32:11.609: ERROR/AndroidRuntime(274): at
android.app.ActivityThread.main(ActivityThread.java:4627)
04-08 12:32:11.609: ERROR/AndroidRuntime(274): at
java.lang.reflect.Method.invokeNative(Native Method)
04-08 12:32:11.609: ERROR/AndroidRuntime(274): at
java.lang.reflect.Method.invoke(Method.java:521)
04-08 12:32:11.609: ERROR/AndroidRuntime(274): at
com.android.internal.os.ZygoteInit
$MethodAndArgsCaller.run(ZygoteInit.java:868)
04-08 12:32:11.609: ERROR/AndroidRuntime(274): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
04-08 12:32:11.609: ERROR/AndroidRuntime(274): at
dalvik.system.NativeStart.main(Native Method)
04-08 12:32:11.609: ERROR/AndroidRuntime(274): Caused by:
java.lang.UnsatisfiedLinkError: Library hello-jni not found
04-08 12:32:11.609: ERROR/AndroidRuntime(274): at
java.lang.Runtime.loadLibrary(Runtime.java:461)
04-08 12:32:11.609: ERROR/AndroidRuntime(274): at
java.lang.System.loadLibrary(System.java:557)
04-08 12:32:11.609: ERROR/AndroidRuntime(274): at
com.example.hellojni.HelloJni.<clinit>(HelloJni.java:67)
04-08 12:32:11.609: ERROR/AndroidRuntime(274): ... 15 more
04-08 12:32:11.678: WARN/ActivityManager(59): Force finishing
activity com.example.hellojni/.HelloJni
04-08 12:32:12.340: WARN/ActivityManager(59): Activity pause timeout
for HistoryRecord{44f925c8 com.example.hellojni/.HelloJni}
How can I make this work?
I had this same issue and I figured it out. The thing that was causing it to mess up for me was in Project Properties -> C/C++ Build -> Build command: was set to 'bash ndk-build' instead of 'bash C:\android-ndk-r6\ndk-build'
I had this problem. It turned out that the GNU tool chain was not installed when I installed Cygwin, and make was being picked up from another SDK installed on my build machine. The fix was to reinstall Cygwin and check that the Gnu tools were installed. (I think the heading is 'Devel' in the Cygwin setup. The default is not to install, change to 'install'). HTH
I tackled this in Eclipse by doing the following:
Right click on the project name and choose "properties"
In the "C/C++ Build" choose "builder section" then in the "builder" group put the following in the "build command" textbox:
bash "_cygwin_home_\home\android-ndk-r6b\ndk-build"
replace "_cygwin_home_" with your actual path to cygwin,
I place the ndk folder inside the home folder in the cygwin installtion folder(as you can see).
I hope this help you.