简体   繁体   English

java.lang.NoClassDefFoundError:无法解决以下问题:Lcom / google / android / gms / vision / face / FaceDetector;

[英]java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/vision/face/FaceDetector;

I'm writing an android plugin for Unity that uses android face detection. 我正在为使用Android人脸检测的Unity编写一个Android插件。 I have the plugin working with the old 我有旧的插件

android.media.FaceDetector;

face detector and I want to update it to the new Google vision APIs 人脸检测器,我想将其更新为新的Google视觉API

For some reason, by simply adding in a declaration of a face detector variable cause the plugin to crash as soon as it starts. 出于某种原因,只需添加面部检测器变量的声明,便会导致插件在启动后立即崩溃。

Here is the relevant code. 这是相关的代码。

package com.test.camerapreview;

import android.app.Activity;
//import android.content.Context;
//import android.graphics.Bitmap;
//import android.graphics.BitmapFactory;
import android.graphics.PointF;
import android.graphics.Rect;
import android.graphics.SurfaceTexture;
import android.hardware.Camera;
//import android.media.FaceDetector;
import android.opengl.GLES11Ext;
import android.opengl.GLES20;
import android.util.Log;
//import android.util.SparseArray;
import android.view.Display;
import android.view.Surface;
//import android.view.SurfaceView;

//import com.google.android.gms.vision.Frame;
import com.google.gson.Gson;
import com.unity3d.player.UnityPlayer;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

//import com.google.android.gms.common.ConnectionResult;
//import com.google.android.gms.common.GoogleApiAvailability;
//import com.google.android.gms.vision.CameraSource;
//import com.google.android.gms.vision.MultiProcessor;
//import com.google.android.gms.vision.Tracker;
//import com.google.android.gms.vision.face.Face;
import com.google.android.gms.vision.face.FaceDetector;

    public class NativeCamera implements Camera.PreviewCallback, Camera.FaceDetectionListener {

        public static NativeCamera instance;
        public static String gameObjectTargetName;
        private static Activity myActivity;

        Camera mCamera;
        int camId;
        SurfaceTexture texture;
        int nativeTexturePointer = -1;

        int unrotatedWidth;
        int unrotatedHeight;
        int rotatedHeight;
        int rotatedWidth;

        com.google.android.gms.vision.face.FaceDetector faceDetector; // Putting this here makes my app crash.

        //
        // Call this function first.
        //
        public static void Setup(String gameObjectName, Activity theActivity){
            gameObjectTargetName = gameObjectName;
            myActivity = theActivity;
            instance = new NativeCamera();
        }

    // Rest of code snipped out
}

The only difference to this source is the addition of the faceDetector variable. 此源的唯一区别是增加了faceDetector变量。 It is not used anywhere. 它没有在任何地方使用。

This is the error that I see in adb logcat 这是我在adb logcat中看到的错误

01-03 14:00:45.798 19649-19787/? W/MDM: InstalledPackageMonitor - <--> getAppVersionForUid(-1) failed to find matching entity
01-03 14:00:46.123 19649-19787/? I/chatty: uid=10117(com.metago.astro) bmv identical 1 line
01-03 14:00:46.141 19649-19787/? W/MDM: InstalledPackageMonitor - <--> getAppVersionForUid(-1) failed to find matching entity
01-03 14:00:46.346 723-830/? I/ThermalEngine: vs_get_temperature: read[0] tsens_tz_sensor15 49000 mC, weight[0] 1
01-03 14:00:46.346 723-830/? I/ThermalEngine: vs_get_temperature: read[1] tsens_tz_sensor0 53000 mC, weight[1] -1
01-03 14:00:46.710 19649-19787/? W/MDM: InstalledPackageMonitor - <--> getAppVersionForUid(-1) failed to find matching entity
01-03 14:00:46.770 14771-14784/? I/zygote64: Waiting for a blocking GC ProfileSaver
01-03 14:00:46.792 14771-14784/? I/zygote64: WaitForGcToComplete blocked ProfileSaver on AddRemoveAppImageSpace for 21.469ms
01-03 14:00:47.348 723-830/? I/ThermalEngine: vs_get_temperature: read[0] tsens_tz_sensor15 49000 mC, weight[0] 1
01-03 14:00:47.348 723-830/? I/ThermalEngine: vs_get_temperature: read[1] tsens_tz_sensor0 52000 mC, weight[1] -1
01-03 14:00:47.492 2286-2286/? I/WearableService: Wearable Services stopping
01-03 14:00:48.350 723-830/? I/ThermalEngine: vs_get_temperature: read[0] tsens_tz_sensor15 48000 mC, weight[0] 1
01-03 14:00:48.350 723-830/? I/ThermalEngine: vs_get_temperature: read[1] tsens_tz_sensor0 52000 mC, weight[1] -1
01-03 14:00:49.352 723-830/? I/ThermalEngine: vs_get_temperature: read[0] tsens_tz_sensor15 48000 mC, weight[0] 1
01-03 14:00:49.352 723-830/? I/ThermalEngine: vs_get_temperature: read[1] tsens_tz_sensor0 52000 mC, weight[1] -1
01-03 14:00:49.904 868-2419/? I/ActivityManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.tvgla.campreview/com.unity3d.player.UnityPlayerActivity bnds=[586,1508][855,1857]} from uid 10032
01-03 14:00:49.908 671-671/? D/QCOM PowerHAL: LAUNCH HINT: ON
01-03 14:00:49.909 1950-1952/? E/ANDR-PERF-OPTSHANDLER: Warning: Resource [2, 0] not supported for core 1. Instead use resource for core 0
01-03 14:00:49.909 658-2267/? I/ACDB-LOADER: ACDB AFE returned = -19
01-03 14:00:49.909 1950-1952/? E/ANDR-PERF-RESOURCEQS: Failed to apply optimization [2, 2, 0]
01-03 14:00:49.909 658-2267/? D/hardware_info: hw_info_append_hw_type : device_name = speaker
01-03 14:00:49.909 658-2267/? D/audio_hw_primary: enable_snd_device: snd_device(2: speaker)
01-03 14:00:49.909 658-2267/? D/audio_route: Apply path: speaker
01-03 14:00:49.909 658-2267/? D/audio_hw_primary: enable_audio_route: usecase(1) apply and update mixer path: low-latency-playback speaker
01-03 14:00:49.909 658-2267/? D/audio_route: Apply path: low-latency-playback speaker
01-03 14:00:49.923 671-671/? D/QCOM PowerHAL: Activity launch hint handled
01-03 14:00:49.948 868-894/? I/ActivityManager: Start proc 14820:com.tvgla.campreview/u0a324 for activity com.tvgla.campreview/com.unity3d.player.UnityPlayerActivity
01-03 14:00:49.948 658-2267/? D/audio_hw_primary: out_write: retry previous failed cal level set
01-03 14:00:49.958 14820-14820/? I/zygote: Late-enabling -Xcheck:jni
01-03 14:00:50.090 14820-14837/? D/OpenGLRenderer: HWUI GL Pipeline
01-03 14:00:50.121 14820-14837/? I/Adreno: QUALCOMM build                   : 2941438, I916dfac403
                                           Build Date                       : 10/03/17
                                           OpenGL ES Shader Compiler Version: EV031.21.02.00
                                           Local Branch                     : O18A
                                           Remote Branch                    : 
                                           Remote Branch                    : 
                                           Reconstruct Branch               : 
01-03 14:00:50.126 14820-14837/? I/Adreno: PFP: 0x005ff087, ME: 0x005ff063
01-03 14:00:50.132 14820-14837/? I/zygote: android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasWideColorDisplay retrieved: 0
01-03 14:00:50.133 14820-14837/? I/OpenGLRenderer: Initialized EGL, version 1.4
01-03 14:00:50.133 14820-14837/? D/OpenGLRenderer: Swap behavior 2
01-03 14:00:50.165 868-918/? I/ActivityManager: Displayed com.tvgla.campreview/com.unity3d.player.UnityPlayerActivity: +225ms
01-03 14:00:50.167 1377-1377/? I/GoogleInputMethod: onFinishInput() : Dummy InputConnection bound
01-03 14:00:50.167 1377-1377/? I/GoogleInputMethod: onStartInput() : Dummy InputConnection bound
01-03 14:00:50.173 671-671/? D/QCOM PowerHAL: LAUNCH HINT: OFF
01-03 14:00:50.192 14820-14836/? I/Unity: SystemInfo CPU = ARMv7 VFPv3 NEON, Cores = 4, Memory = 3753mb
01-03 14:00:50.192 14820-14836/? I/Unity: SystemInfo ARM big.LITTLE configuration: 2 big (mask: 12), 2 little (mask: 3)
01-03 14:00:50.192 14820-14836/? I/Unity: ApplicationInfo com.tvgla.campreview version 1.0 build 44c1fe70-80a4-4a60-8a18-207b4d37a86f
01-03 14:00:50.195 14836-14836/? W/UnityMain: type=1400 audit(0.0:91697): avc: denied { read } for name="stat" dev="proc" ino=4026532357 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:proc_stat:s0 tclass=file permissive=0
01-03 14:00:50.262 14820-14836/? E/Unity: Unable to find AudioPluginMsHRTF
01-03 14:00:50.263 14820-14836/? E/Unity: Unable to find AudioPluginOculusSpatializer
01-03 14:00:50.264 14820-14836/? E/Unity: Unable to find unitygar
01-03 14:00:50.264 14820-14836/? E/Unity: Unable to find libAudioPluginOculusSpatializer
01-03 14:00:50.266 14820-14836/? E/Unity: Unable to find libtango_3d_reconstruction_api
01-03 14:00:50.280 14820-14836/? D/Unity:  GL_OES_EGL_image GL_OES_EGL_image_external GL_OES_EGL_sync GL_OES_vertex_half_float GL_OES_framebuffer_object GL_OES_rgb8_rgba8 GL_OES_compressed_ETC1_RGB8_texture GL_AMD_compressed_ATC_texture GL_KHR_texture_compression_astc_ldr GL_KHR_texture_compression_astc_hdr GL_OES_texture_compression_astc GL_OES_texture_npot GL_EXT_texture_filter_anisotropic GL_EXT_texture_format_BGRA8888 GL_OES_texture_3D GL_EXT_color_buffer_float GL_EXT_color_buffer_half_float GL_QCOM_alpha_test GL_OES_depth24 GL_OES_packed_depth_stencil GL_OES_depth_texture GL_OES_depth_texture_cube_map GL_EXT_sRGB GL_OES_texture_float GL_OES_texture_float_linear GL_OES_texture_half_float GL_OES_texture_half_float_linear GL_EXT_texture_type_2_10_10_10_REV GL_EXT_texture_sRGB_decode GL_OES_element_index_uint GL_EXT_copy_image GL_EXT_geometry_shader GL_EXT_tessellation_shader GL_OES_texture_stencil8 GL_EXT_shader_io_blocks GL_OES_shader_image_atomic GL_OES_sample_variables GL_EXT_texture_border_clamp GL_EXT_multisampled_render_to_texture GL_EXT_mul
01-03 14:00:50.280 14820-14836/? D/Unity: tisampled_render_to_texture2 GL_OES_shader_multisample_interpolation GL_EXT_texture_cube_map_array GL_EXT_draw_buffers_indexed GL_EXT_gpu_shader5 GL_EXT_robustness GL_EXT_texture_buffer GL_EXT_shader_framebuffer_fetch GL_ARM_shader_framebuffer_fetch_depth_stencil GL_OES_texture_storage_multisample_2d_array GL_OES_sample_shading GL_OES_get_program_binary GL_EXT_debug_label GL_KHR_blend_equation_advanced GL_KHR_blend_equation_advanced_coherent GL_QCOM_tiled_rendering GL_ANDROID_extension_pack_es31a GL_EXT_primitive_bounding_box GL_OES_standard_derivatives GL_OES_vertex_array_object GL_EXT_disjoint_timer_query GL_KHR_debug GL_EXT_YUV_target GL_EXT_sRGB_write_control GL_EXT_texture_norm16 GL_EXT_discard_framebuffer GL_OES_surfaceless_context GL_OVR_multiview GL_OVR_multiview2 GL_EXT_texture_sRGB_R8 GL_KHR_no_error GL_EXT_debug_marker GL_OES_EGL_image_external_essl3 GL_OVR_multiview_multisampled_render_to_texture GL_EXT_buffer_storage GL_EXT_external_buffer GL_EXT_blit_framebuffer_params GL_EXT_clip_cull_distance
01-03 14:00:50.280 14820-14836/? D/Unity:  GL_EXT_protected_textures GL_EXT_shader_non_constant_global_initializers GL_QCOM_framebuffer_foveated GL_QCOM_shader_framebuffer_fetch_noncoherent GL_EXT_EGL_image_array GL_NV_shader_noperspective_interpolation

                                          [ 01-03 14:00:50.316 14820:14836 D/         ]
                                          PlayerBase::PlayerBase()

                                          [ 01-03 14:00:50.317 14820:14836 D/         ]
                                          TrackPlayerBase::TrackPlayerBase()
01-03 14:00:50.317 14820-14836/? I/libOpenSLES: Emulating old channel mask behavior (ignoring positional mask 0x3, using default mask 0x3 based on channel count of 2)
01-03 14:00:50.317 14820-14836/? W/AudioTrack: notificationFrames=-10 clamped to the range -1 to -8
01-03 14:00:50.319 14820-14836/? I/AudioTrack: AUDIO_OUTPUT_FLAG_FAST successful; frameCount 1536 -> 1536
01-03 14:00:50.319 14820-14836/? D/AudioTrack: Client defaulted notificationFrames to 192 for frameCount 1536
01-03 14:00:50.321 1342-1881/? D/Avrcp: AudioManager Player: ID:23 -- type:android.media.SoundPool -- u/pid:10043/1393 -- state:idle -- attr:AudioAttributes: usage=USAGE_ASSISTANCE_SONIFICATION content=CONTENT_TYPE_SONIFICATION flags=0x0 tags= bundle=null
01-03 14:00:50.321 1342-1881/? D/Avrcp: AudioManager Player: ID:15 -- type:android.media.SoundPool -- u/pid:1000/868 -- state:idle -- attr:AudioAttributes: usage=USAGE_ASSISTANCE_SONIFICATION content=CONTENT_TYPE_SONIFICATION flags=0x0 tags= bundle=null
01-03 14:00:50.321 1342-1881/? D/Avrcp: AudioManager Player: ID:31 -- type:android.media.SoundPool -- u/pid:1027/2374 -- state:idle -- attr:AudioAttributes: usage=USAGE_NOTIFICATION content=CONTENT_TYPE_SONIFICATION flags=0x0 tags= bundle=null
01-03 14:00:50.321 1342-1881/? D/Avrcp: AudioManager Player: ID:2431 -- type:android.media.MediaPlayer -- u/pid:10035/8516 -- state:idle -- attr:AudioAttributes: usage=USAGE_UNKNOWN content=CONTENT_TYPE_UNKNOWN flags=0x0 tags= bundle=null
01-03 14:00:50.321 1342-1881/? D/Avrcp: AudioManager Player: ID:2447 -- type:android.media.MediaPlayer -- u/pid:10043/1393 -- state:stopped -- attr:AudioAttributes: usage=USAGE_NOTIFICATION content=CONTENT_TYPE_SONIFICATION flags=0x0 tags= bundle=null
01-03 14:00:50.321 1342-1881/? D/Avrcp: AudioManager Player: ID:2527 -- type:OpenSL ES AudioPlayer (Buffer Queue) -- u/pid:10324/14820 -- state:started -- attr:AudioAttributes: usage=USAGE_MEDIA content=CONTENT_TYPE_UNKNOWN flags=0x0 tags= bundle=null
01-03 14:00:50.321 1342-1881/? D/Avrcp: AudioManager isPlaying: true
01-03 14:00:50.322 656-656/? W//system/bin/hw/android.hidl.allocator@1.0-service: ashmem_create_region(3840) returning hidl_memory(0x7d5f82b330, 3840)
01-03 14:00:50.323 656-656/? W//system/bin/hw/android.hidl.allocator@1.0-service: ashmem_create_region(3840) returning hidl_memory(0x7d5f82b330, 3840)
01-03 14:00:50.332 658-22045/? E/volume_listener: check_and_set_gain_dep_cal: Failed to set gain dep cal level
01-03 14:00:50.333 1342-1881/? E/Avrcp: play status change 2➡1 mPlayStatusChangedNT: 1
01-03 14:00:50.334 1342-1881/? E/bt_btif: register_notification_rsp: Avrcp device is not connected, handle: 0x0
01-03 14:00:50.334 1342-1881/? D/Avrcp: sendPlayPosNotificationRsp: Not registered or requesting.
01-03 14:00:50.334 1950-1952/? E/ANDR-PERF-OPTSHANDLER: Warning: Resource [2, 0] not supported for core 1. Instead use resource for core 0
01-03 14:00:50.334 658-9407/? I/ACDB-LOADER: ACDB AFE returned = -19
01-03 14:00:50.334 1950-1952/? E/ANDR-PERF-RESOURCEQS: Failed to apply optimization [2, 2, 0]
01-03 14:00:50.334 658-9407/? D/audio_hw_primary: enable_audio_route: usecase(5) apply and update mixer path: audio-ull-playback speaker
01-03 14:00:50.334 658-9407/? D/audio_route: Apply path: audio-ull-playback speaker
01-03 14:00:50.342 658-9407/? D/audio_hw_primary: out_write: retry previous failed cal level set
01-03 14:00:50.354 723-830/? I/ThermalEngine: vs_get_temperature: read[0] tsens_tz_sensor15 49000 mC, weight[0] 1
01-03 14:00:50.354 723-830/? I/ThermalEngine: vs_get_temperature: read[1] tsens_tz_sensor0 54000 mC, weight[1] -1
01-03 14:00:50.383 1543-1543/? D/zz: UtWallpaperService$UtEngine.onVisibilityChanged() false
01-03 14:00:50.386 1543-1543/? D/zz: UtRenderer.onNotVisible() 
01-03 14:00:50.504 2331-2331/? I/PBSessionCacheImpl: Deleted sessionId[8605084760413] from persistence.
01-03 14:00:50.533 868-1542/? I/WifiService: getWifiEnabledState uid=10048
01-03 14:00:50.550 2331-2331/? W/SearchService: Abort, client detached.
01-03 14:00:51.356 723-830/? I/ThermalEngine: vs_get_temperature: read[0] tsens_tz_sensor15 50000 mC, weight[0] 1
01-03 14:00:51.356 723-830/? I/ThermalEngine: vs_get_temperature: read[1] tsens_tz_sensor0 54000 mC, weight[1] -1
01-03 14:00:52.357 723-830/? I/ThermalEngine: vs_get_temperature: read[0] tsens_tz_sensor15 49000 mC, weight[0] 1
01-03 14:00:52.357 723-830/? I/ThermalEngine: vs_get_temperature: read[1] tsens_tz_sensor0 53000 mC, weight[1] -1
01-03 14:00:52.979 868-894/? W/SensorService: sensor 00000001 already enabled in connection 0x782da33f00 (ignoring)
01-03 14:00:53.116 658-22045/? D/audio_hw_primary: disable_audio_route: usecase(1) reset and update mixer path: low-latency-playback speaker
01-03 14:00:53.154 14820-14836/? E/Unity: AndroidJavaException: java.lang.NoSuchFieldError: no "Ljava/lang/Object;" field "instance" in class "Lcom/test/camerapreview/NativeCamera;" or its superclasses
                                          java.lang.NoSuchFieldError: no "Ljava/lang/Object;" field "instance" in class "Lcom/test/camerapreview/NativeCamera;" or its superclasses
                                              at com.unity3d.player.UnityPlayer.nativeRender(Native Method)
                                              at com.unity3d.player.UnityPlayer.c(Unknown Source:0)
                                              at com.unity3d.player.UnityPlayer$c$1.handleMessage(Unknown Source:151)
                                              at android.os.Handler.dispatchMessage(Handler.java:102)
                                              at android.os.Looper.loop(Looper.java:164)
                                              at com.unity3d.player.UnityPlayer$c.run(Unknown Source:20)
                                            at UnityEngine.AndroidJNISafe.CheckException () [0x00000] in <filename unknown>:0 
                                            at UnityEngine.AndroidJNISafe.GetStaticFieldID (IntPtr clazz, System.String name, System.String sig) [0x00000] in <filename unknown>:0 
                                            at UnityEngine._AndroidJNIHelper.GetFieldID (IntPtr jclass, System.String fieldName, System.String signature, Boolean isStatic) [0x00000] in <filena

It is complaining about the variable called instance which is set in the Setup function that is called from Unity. 它抱怨在由Unity调用的Setup函数中设置的名为instance的变量。 Without this variable, my plugin works. 没有此变量,我的插件可以工作。 With it, it crashes. 有了它,它崩溃了。

I did also make a change to my build.gradle file. 我也确实对build.gradle文件进行了更改。 Here it is. 这里是。

apply plugin: 'com.android.library'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.3"

    defaultConfig {
        minSdkVersion 18
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"

    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile 'com.android.support:appcompat-v7:25.3.1'
    compile 'com.google.android.gms:play-services-vision:9.4.0+' // I added this line.
    provided files('./libs/UnityPlayer.jar')
    compile files('libs/gson-2.8.2.jar')
}

android.libraryVariants.all { variant ->
    // Task names.
    String variantName = "${variant.name.capitalize()}"; // Like 'Debug'
    String deployTaskGroup = "plugin";
    String deployTaskName = "deploy${variantName}PluginArchive"; // Like 'deployDebugPluginArchive'
    String dependencyTaskName = "assemble${variantName}"; // Like 'assembleDebug'
    // Source.
    String sourceAARFolder = "${buildDir.getPath()}/outputs/aar/";
    String sourceAARName = "${project.name}-${variant.name}.aar";
    // Target.
    String targetAARFolder = "../../../Assets/Plugins/Android"; // Navigate into 'Assets'
    String targetAARName = "Native Camera.aar"; // The form you ship your plugin
    // Create task.
    task(deployTaskName, dependsOn: dependencyTaskName, type: Copy) {
        from(sourceAARFolder)
        into(targetAARFolder)
        include(sourceAARName)
        rename(sourceAARName, targetAARName)
    }.group = deployTaskGroup;
}

I added the line 我加了线

compile 'com.google.android.gms:play-services-vision:9.4.0+'

Update 更新资料

I have tried renaing the variable from instance to mInstance and I had the same issuue. 我尝试将变量从实例重命名为mInstance,并且发出了相同的问题。 I then tried creating the variable inside a function and returning it. 然后,我尝试在函数内创建变量并将其返回。 Now I have a more intuitive error log, which I am not sure how to fix. 现在,我有一个更直观的错误日志,我不确定该如何解决。

01-03 14:38:32.505 19629-19646/? E/Unity: AndroidJavaException: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/vision/face/FaceDetector;
                                          java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/vision/face/FaceDetector;
                                              at java.lang.reflect.Executable.getMethodReturnTypeInternal(Native Method)
                                              at java.lang.reflect.Method.getReturnType(Method.java:141)
                                              at java.lang.Class.getDeclaredMethods(Class.java:1880)
                                              at com.unity3d.player.ReflectionHelper.getMethodID(Unknown Source:63)
                                              at com.unity3d.player.UnityPlayer.nativeRender(Native Method)
                                              at com.unity3d.player.UnityPlayer.c(Unknown Source:0)
                                              at com.unity3d.player.UnityPlayer$c$1.handleMessage(Unknown Source:151)
                                              at android.os.Handler.dispatchMessage(Handler.java:102)
                                              at android.os.Looper.loop(Looper.java:164)
                                              at com.unity3d.player.UnityPlayer$c.run(Unknown Source:20)
                                           Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.vision.face.FaceDetector" on path: DexPathList[[zip file "/data/app/com.tvgla.campreview-C0

Thanks John Lawrie 谢谢约翰·劳里

I had the same problem however, It was due to the fact that I was including my custom library with Gson code as a .aar in an android application project. 但是,我遇到了同样的问题,这是由于我将自己的自定义库以及Gson代码作为.aar包含在android应用程序项目中。 and since .aar files don't propagate dependencies transitively , I was getting the error for Gson class in my application project, importing gson in the application project solved the issue! 既然.aar文件不传播依赖传递性 ,我正在为GSON类的错误在我的应用工程, 引进GSON应用程序项目中解决的问题!

Proguard : if you are using proguard to obfuscate the code make sure you add proper rules for gson which can be found here Proguard :如果您正在使用proguard混淆代码,请确保为gson添加了适当的规则,可在此处找到

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 java.lang.NoClassDefFoundError: Failed resolution Failed resolution of: Lcom/google/android/gms/common/internal/zzab; - java.lang.NoClassDefFoundError: Failed resolution Failed resolution of: Lcom/google/android/gms/common/internal/zzab; java.lang.NoClassDefFoundError:无法解决以下问题:Lcom / google / android / gms / R $ styleable; 在谷歌地图集成 - java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/R$styleable; in google map integration java.lang.NoClassDefFoundError:无法解决以下问题:Lcom / google / android / gms / common / internal / zzbo; - java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/common/internal/zzbo; java.lang.NoClassDefFoundError:解析失败:Lcom / google / android / gms / common / internal / zzbq; - java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/common/internal/zzbq; 造成原因:java.lang.NoClassDefFoundError:无法解决以下问题:Lcom / google / android / gms / common / util / Function; - Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/common/util/Function; java.lang.NoClassDefFoundError:解析失败:Lcom/google/android/gms/common/util/zzq; - java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/common/util/zzq; java.lang.NoClassDefFoundError:无法解决以下问题:Lcom / google / android / gms / common / GoogleApiAvailabilityLight; - java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/common/GoogleApiAvailabilityLight; 用firebase java.lang.NoClassDefFoundError响应本机:无法解决以下问题:Lcom / google / android / gms / common / internal / zzbq - React Native with firebase java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/common/internal/zzbq java.lang.NoClassDefFoundError:解析失败:Lcom / google / android / gms / common / GooglePlayServicesUtil - java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/common/GooglePlayServicesUtil java.lang.NoClassDefFoundError:解析失败:Lcom/google/android/gms/common/internal/zzbp - java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/common/internal/zzbp
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM