Android Camera get parameter issue on commonsguy/cwac-camera - android

I used commonsguy/cwac-camera for a custom camera view, image capturing is working fine, but when trying to start recording video, the app crashed.
My Stack trace is this,
java.lang.RuntimeException: getParameters failed (empty parameters)
at android.hardware.Camera.native_getParameters(Native Method)
at android.hardware.Camera.getParameters(Camera.java:2112)
at com.commonsware.cwac.camera.CameraView$OnOrientationChange.onOrientationChanged(CameraView.java:658)
at android.view.OrientationEventListener$SensorEventListenerImpl.onSensorChanged(OrientationEventListener.java:143)
at android.hardware.SystemSensorManager$ListenerDelegate$1.handleMessage(SystemSensorManager.java:261)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:194)
at android.app.ActivityThread.main(ActivityThread.java:5391)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:833)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
at dalvik.system.NativeStart.main(Native Method)
Activity is strictly in portrait mode, recording is working fine in MOTO G, but not in Samsung Tab and Micromax, getting same error.
Also I used latest version of "commonsguy/cwac-camera"
One Micromax Device Model is A114 (4.2.2) where i getting the error

Related

Android MultiDex app crashing on low APIs on Android Studio 3.0

I was trying to run an app that requires MultiDex using Android Studio 3.0 on an API 16 device and when the app is finally trying to launch, it crashes.
The same occurs on other low APIs (eg.: 17, 18, 19)
But, when I tried to run the app using the Android Studio 3.1 (beta version), no crashes occur.
Is there any way this crash can be fixed?
FATAL EXCEPTION: main
java.lang.ExceptionInInitializerError
at android.support.multidex.MultiDexApplication.<init>(MultiDexApplication.java:35)
at MY_APP_PATH.MY_CUSTOM_APPLICATION_CLASS.<init>(MY_CUSTOM_APP_CLASS.java:23)
at java.lang.Class.newInstanceImpl(Native Method)
at java.lang.Class.newInstance(Class.java:1319)
at android.app.Instrumentation.newApplication(Instrumentation.java:997)
at android.app.Instrumentation.newApplication(Instrumentation.java:982)
at android.app.LoadedApk.makeApplication(LoadedApk.java:496)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4170)
at android.app.ActivityThread.access$1400(ActivityThread.java:134)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4867)
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:1007)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:774)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.UnsatisfiedLinkError: Cannot load library: reloc_library[1306]: 1674 cannot locate '__isnanf'...
at java.lang.Runtime.loadLibrary(Runtime.java:370)
at java.lang.System.loadLibrary(System.java:535)
at com.android.tools.profiler.support.ProfilerService.<clinit>(ProfilerService.java:41)
at android.support.multidex.MultiDexApplication.<init>(MultiDexApplication.java:35) 
at MY_APP_PATH.MY_CUSTOM_APPLICATION_CLASS.<init>(MY_CUSTOM_APPLICATION_CLASS.java:23) 
at java.lang.Class.newInstanceImpl(Native Method) 
at java.lang.Class.newInstance(Class.java:1319) 
at android.app.Instrumentation.newApplication(Instrumentation.java:997) 
at android.app.Instrumentation.newApplication(Instrumentation.java:982) 
at android.app.LoadedApk.makeApplication(LoadedApk.java:496) 
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4170) 
at android.app.ActivityThread.access$1400(ActivityThread.java:134) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278) 
at android.os.Handler.dispatchMessage(Handler.java:99) 
at android.os.Looper.loop(Looper.java:137) 
at android.app.ActivityThread.main(ActivityThread.java:4867) 
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:1007) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:774) 
at dalvik.system.NativeStart.main(Native Method) 
Issue should be about enabling "advanced profiling" feature in AS 3.0, if you've done so just disable it:
Go to "Edit Configurations...",
Select your app configuration under "Android App",
Then go "Profiling" tab and
Uncheck "Enable advanced profiling"
Problem should be gone.

"Unfortunately, application has stopped" for some version of Android

I have an application available on Google Play. Some people told me they were having an issue. When they open the application, it directly crashes and says "Unfortunately, [application name] has stopped".
When I started to program my project, I had the same problem with an Android 4.2.2. I just told me that it was a problem only for this version of Android, because when I used my bother's phone and my friends' phone everything worked. But finally not. People are having the same issue with and Android 5.0 or Android 5.0.2, and maybe some more.
I have few other red lines, but I will show you only the biggest part, which seems suspect. When I launch my app, I get this :
08-19 21:27:35.135 26504-26504/com.histoire_horreur E/AndroidRuntime: FATAL EXCEPTION: main
java.lang.NoClassDefFoundError: com.histoire_horreur.Listener.ScrollListener
at com.histoire_horreur.MainActivity.createView(MainActivity.java:59)
at com.histoire_horreur.MainActivity.onCreate(MainActivity.java:47)
at android.app.Activity.performCreate(Activity.java:5122)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1150)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2315)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2403)
at android.app.ActivityThread.access$600(ActivityThread.java:165)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1373)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:194)
at android.app.ActivityThread.main(ActivityThread.java:5391)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:833)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
at dalvik.system.NativeStart.main(Native Method)
Android Studio doesn't underline any line in my code to tell me that this class is not found. ScrollListener is a class I created and it exists. I imported it. Anyway... I decided to delete line 59 to see what happens. When I did, I get a new error :
08-19 21:33:09.317 26953-26953/com.histoire_horreur E/AndroidRuntime: FATAL EXCEPTION: main
java.lang.NoClassDefFoundError: android.support.v7.view.menu.MenuBuilder
at android.support.v7.app.AppCompatDelegateImplV7.initializePanelMenu(AppCompatDelegateImplV7.java:1232)
at android.support.v7.app.AppCompatDelegateImplV7.preparePanel(AppCompatDelegateImplV7.java:1296)
at android.support.v7.app.AppCompatDelegateImplV7.doInvalidatePanelMenu(AppCompatDelegateImplV7.java:1591)
at android.support.v7.app.AppCompatDelegateImplV7.access$100(AppCompatDelegateImplV7.java:91)
at android.support.v7.app.AppCompatDelegateImplV7$1.run(AppCompatDelegateImplV7.java:130)
at android.os.Handler.handleCallback(Handler.java:800)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:194)
at android.app.ActivityThread.main(ActivityThread.java:5391)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:833)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
at dalvik.system.NativeStart.main(Native Method)
This error is a mystery for me. I didn't even use MenuBuilder somewhere.
Can you help me because I now don't know where to focus. I searched a lot on StackOverflow and nothing solved my problem. There are a lot of similar errors but with a different log. Some people who had the same issue said it was just a problem of Android 4.2.2. But it is not.
About MenuBuilder problem, you need to change your build.gradle file as I did there :
Then it worked with my Wiko 4.2.2.
About ScrollListener problem, I will create a new subject.

Exitting Libgdx App on Android Device

When I exit my game by Gdx.app.exit() on android device it gives me App has stopped message
Is this a proper way to exit a libgdx app ?
and Are assets disposed by this way ? I put Assets.dispose() in my game class dispose() method
It gives me this exception
java.lang.NullPointerException at com.badlogic.gdx.backends.android.AndroidInput.lookUpPointerIndex(AndroidInput.java:802) at com.badlogic.gdx.backends.android.AndroidMultiTouchHandler.onTouch(AndroidMultiTouchHandler.java:64) at com.badlogic.gdx.backends.android.AndroidInput.onTouch(AndroidInput.java:429) at android.view.View.dispatchTouchEvent(View.java:7793) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2287) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2027) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2287) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2027) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2287) at android.view.ViewGroup.cancelAndClearTouchTargets(ViewGroup.java:2128) at android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:2686) at android.view.ViewRootImpl.dispatchDetachedFromWindow(ViewRootImpl.java:3201) at android.view.ViewRootImpl.doDie(ViewRootImpl.java:5810) at android.view.ViewRootImpl.die(ViewRootImpl.java:5783) at android.view.WindowManagerGlobal.removeViewLocked(WindowManagerGlobal.java:348) at android.view.WindowManagerGlobal.removeView(WindowManagerGlobal.java:303) at android.view.WindowManagerImpl.removeViewImmediate(WindowManagerImpl.java:84) at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:3776) at android.app.ActivityThread.access$1500(ActivityThread.java:151) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1407) at android.os.Handler.dispatchMessage(Handler.java:110) at android.os.Looper.loop(Looper.java:193) at android.app.ActivityThread.main(ActivityThread.java:5345) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:828) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:644) at dalvik.system.NativeStart.main(Native Method)
The problem was in touchDown() method of InputListener which I used to addListener to exit button
I replaced it by clicked() of ClickListener and it solved the problem

java.lang.NoClassDefFoundError: com.google.api.client.http.apache.ApacheHttpTransport() on some phones Kinvey Android?

The following error is obtained when running my app using the Kinvey client library:
E/AndroidRuntime: FATAL EXCEPTION: main
java.lang.NoClassDefFoundError: com.google.api.client.http.apache.ApacheHttpTransport
at com.kinvey.android.Client$Builder.newCompatibleTransport(Client.java:555)
at com.kinvey.android.Client$Builder.<init>(Client.java:609)
at ch.ethz.nervousnet.trialapp04.MainActivity.onCreate(MainActivity.java:94)
at android.app.Activity.performCreate(Activity.java:5122)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1081)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2337)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2425)
at android.app.ActivityThread.access$600(ActivityThread.java:162)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1364)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:194)
at android.app.ActivityThread.main(ActivityThread.java:5422)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:837)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:604)
at dalvik.system.NativeStart.main(Native Method)
The Line in MainActivity class it points to is the following:
Global.setmKinveyClient(new Client.Builder(this.getApplicationContext()).build());
// Client if a library class, not the one I have created
It works on most phones, but on some phones does not work, what could be the cause?
Here is a screen shot of all the libs I have in the project :
Any help is appreciated, thank you.
LoveMeow,
What is the Android version on phones where it is not working? Is it the same version or happens randomly?
Since it is working for you on some phones, all the dependent libraries seem to be added properly. Are there any other warnings that are being thrown?
Thanks,
Pranav
Kinvey Support

MySQLNonTransientConnectionException: Could not create connection to database server

I am dealing with a strange problem connecting to my MySQL database on Amazon RDS using JDBC. I have two different Android phones on the same network running the same code. One connects without any problems. The other is giving me the following exception:
com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to database server.
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
at com.mysql.jdbc.Util.getInstance(Util.java:386)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1014)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:988)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:974)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:919)
at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2547)
at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2283)
at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:822)
at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47)
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:404)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:317)
at java.sql.DriverManager.getConnection(DriverManager.java:175)
at java.sql.DriverManager.getConnection(DriverManager.java:209)
at edu.ucsb.cs.epsilon.ucsb360.DatabaseManager.Connect(DatabaseManager.java:32)
at edu.ucsb.cs.epsilon.ucsb360.Global.applicationResumed(Global.java:31)
at edu.ucsb.cs.epsilon.ucsb360.MainActivity.onResume(MainActivity.java:54)
at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1236)
at android.app.Activity.performResume(Activity.java:4625)
at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2834)
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2889)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:156)
at android.app.ActivityThread.main(ActivityThread.java:5045)
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: android.os.NetworkOnMainThreadException
at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1190)
at java.net.InetAddress.lookupHostByName(InetAddress.java:394)
at java.net.InetAddress.getAllByNameImpl(InetAddress.java:245)
at java.net.InetAddress.getAllByName(InetAddress.java:220)
at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:249)
at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:305)
at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2461)
at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2498)
The database only shows 1 active connection, so I know it is not because of too many open connections. I have tried rebooting the server, but it didn't help. I am using the MySQL JDBC Connector/J version 5.1.23. The phone that works is running Android version 2.3.5 and the one that doesn't work is running Android version 4.0.4. Does anyone have any ideas as to what might be wrong?
Thanks!
Caused by: android.os.NetworkOnMainThreadException
You can't do network IO on the main thread. Move it to an AsyncTask or thread.

Categories

Resources