Problem when I try to save data in Mysql database on Android

Asked

Viewed 165 times

0

I’m doing an Android project that uses the Ion library to communicate with the Mysql database, but when I try to save the data, this error appears:

Log:

 08-20 09:23:28.981 2365-2895/com.lp3bmobi.app.controlechamados W/IonConscrypt: Conscrypt initialization failed.

   java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/security/ProviderInstaller;

      at com.koushikdutta.ion.conscrypt.ConscryptMiddleware.initialize(ConscryptMiddleware.java:58)

      at com.koushikdutta.ion.conscrypt.ConscryptMiddleware.initialize(ConscryptMiddleware.java:75)

      at com.koushikdutta.ion.conscrypt.ConscryptMiddleware.getSocket(ConscryptMiddleware.java:103)

      at com.koushikdutta.async.http.AsyncHttpClient.executeAffinity(AsyncHttpClient.java:301)

      at com.koushikdutta.async.http.AsyncHttpClient.access$100(AsyncHttpClient.java:51)

      at com.koushikdutta.async.http.AsyncHttpClient$1.run(AsyncHttpClient.java:190)

      at com.koushikdutta.async.AsyncServer.lockAndRunQueue(AsyncServer.java:740)

      at com.koushikdutta.async.AsyncServer.runLoop(AsyncServer.java:758)

      at com.koushikdutta.async.AsyncServer.run(AsyncServer.java:658)

      at com.koushikdutta.async.AsyncServer.access$800(AsyncServer.java:44)

      at com.koushikdutta.async.AsyncServer$14.run(AsyncServer.java:600)

      Caused by: java.lang.ClassNotFoundException: Didn't find class 
      "com.google.android.gms.security.ProviderInstaller" on path: 
      DexPathList[[zip file 
      "/data/app/com.lp3bmobi.app.controlechamados-
      1/base.apk", zip file 
      "/data/app/com.lp3bmobi.app.controlechamados-
      1/split_lib_dependencies_apk.apk", zip file 
      "/data/app/com.lp3bmobi.app.controlechamados-
      1/split_lib_slice_0_apk.apk", zip file 
      "/data/app/com.lp3bmobi.app.controlechamados-
       1/split_lib_slice_1_apk.apk", zip file 
       "/data/app/com.lp3bmobi.app.controlechamados-
        1/split_lib_slice_2_apk.apk", zip file 
       "/data/app/com.lp3bmobi.app.controlechamados-
        1/split_lib_slice_3_apk.apk", zip file 
        "/data/app/com.lp3bmobi.app.controlechamados-
         1/split_lib_slice_4_apk.apk", zip file 
         "/data/app/com.lp3bmobi.app.controlechamados-
         1/split_lib_slice_5_apk.apk", zip file 
         "/data/app/com.lp3bmobi.app.controlechamados-
         1/split_lib_slice_6_apk.apk", zip file 
         "/data/app/com.lp3bmobi.app.controlechamados-
          1/split_lib_slice_7_apk.apk", zip file 
         "/data/app/com.lp3bmobi.app.controlechamados-
         1/split_lib_slice_8_apk.apk", zip file 
         "/data/app/com.lp3bmobi.app.controlechamados-
         1/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=
         [/vendor/lib, /system/lib]]

         at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)

         at java.lang.ClassLoader.loadClass(ClassLoader.java:511)

         at java.lang.ClassLoader.loadClass(ClassLoader.java:469)

         at com.koushikdutta.ion.conscrypt.ConscryptMiddleware.initialize(ConscryptMiddleware.java:58) 

         at com.koushikdutta.ion.conscrypt.ConscryptMiddleware.initialize(ConscryptMiddleware.java:75) 

         at com.koushikdutta.ion.conscrypt.ConscryptMiddleware.getSocket(ConscryptMiddleware.java:103) 

         at com.koushikdutta.async.http.AsyncHttpClient.executeAffinity(AsyncHttpClient.java:301) 

         at com.koushikdutta.async.http.AsyncHttpClient.access$100(AsyncHttpClient.java:51) 

         at com.koushikdutta.async.http.AsyncHttpClient$1.run(AsyncHttpClient.java:190) 

         at com.koushikdutta.async.AsyncServer.lockAndRunQueue(AsyncServer.java:740) 

         at com.koushikdutta.async.AsyncServer.runLoop(AsyncServer.java:758) 

         at com.koushikdutta.async.AsyncServer.run(AsyncServer.java:658) 

         at com.koushikdutta.async.AsyncServer.access$800(AsyncServer.java:44) 

         at com.koushikdutta.async.AsyncServer$14.run(AsyncServer.java:600) 

         Suppressed: java.lang.ClassNotFoundException: com.google.android.gms.security.ProviderInstaller

         at java.lang.Class.classForName(Native Method)

         at java.lang.BootClassLoader.findClass(ClassLoader.java:781)

         at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)

         at java.lang.ClassLoader.loadClass(ClassLoader.java:504)

         ... 12 more

        Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available
       08-20 09:23:58.971 2365-2365/com.lp3bmobi.app.controlechamados D/AndroidRuntime: Shutting down VM


        java.lang.NullPointerException: Attempt to invoke virtual method 'com.google.gson.JsonElement com.google.gson.JsonObject.get(java.lang.String)' on a null object reference

        at com.lp3bmobi.app.controlechamados.activity.NovoClienteActivity$1$1.onCompleted(NovoClienteActivity.java:48)

        at com.lp3bmobi.app.controlechamados.activity.NovoClienteActivity$1$1.onCompleted(NovoClienteActivity.java:45)

        at com.koushikdutta.async.future.SimpleFuture.handleCallbackUnlocked(SimpleFuture.java:107)

        at com.koushikdutta.async.future.SimpleFuture.setComplete(SimpleFuture.java:141)

        at com.koushikdutta.async.future.SimpleFuture.setComplete(SimpleFuture.java:124)

        at com.koushikdutta.ion.IonRequestBuilder$1.run(IonRequestBuilder.java:244)

        at com.koushikdutta.async.AsyncServer$RunnableWrapper.run(AsyncServer.java:60)

        at android.os.Handler.handleCallback(Handler.java:739)

        at android.os.Handler.dispatchMessage(Handler.java:95)

        at android.os.Looper.loop(Looper.java:135)

        at android.app.ActivityThread.main(ActivityThread.java:5254)

        at java.lang.reflect.Method.invoke(Native Method)

        at java.lang.reflect.Method.invoke(Method.java:372)

        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)

        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)

1 answer

0

So my big, about the error, seems to be a dependency thing, check if called and configured all dependencies, if you are using Android Studio it will already inform you about, otherwise check the android version you want to compile and the compatibility of that Ion for it. Now if you are using Mysql local I suggest using Sqlite that will be better and faster in performance, see more on https://developer.android.com/reference/android/database/sqlite/package-summary.html

If you’re trying to connect directly to Mysql on an external server, I suggest using an/webservice/rpc api to help you manage this and you don’t have to keep opening mobile connection directly to your database. This way is better because later you can even implement token system and access control by api.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.