HMS-Core / hms-mapkit-demo

HMS Map Kit demo provides an example of intergrating HMS Map Android SDK. Personalizing how your map displays and interacts with your users tailors their experience to them
https://developer.huawei.com/consumer/en/hms/huawei-MapKit?ha_source=hms1
Apache License 2.0
115 stars 43 forks source link

ClassNotFoundException #18

Open mcmadsen opened 1 year ago

mcmadsen commented 1 year ago

Sorry, if this has been asked before, but I keep getting a ClassNotFoundException and when running the sample and the map is not rendering.

Running on Device: Honor X8 / TFY-LX! Magic UI Version: 3.2 Android version 1.1 HMS Core: 6.7.0.322

Log:

0/17 12:59:39: Launching 'app' on HONOR TFY-LX1. Install successfully finished in 1 s 567 ms. $ adb shell am start -n "com./com.huawei.hms.maps.sample.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER Connected to process 3784 on device 'honor-tfy_lx1-ALDEVB2420002585'. Capturing and displaying logcat messages from application. This behavior can be disabled in the "Logcat output" section of the "Debugger" settings page. D/HwFrameworkSecurityPartsFactory: HwFrameworkSecurityPartsFactory in. I/HwFrameworkSecurityPartsFactory: add HwFrameworkSecurityPartsFactory to memory. E/BehaviorCollectManager: Fail to acquire dataAnalyzerService... W/HwCust: CUST VERSION = false, use class = class android.app.HwCustApplicationPackageManagerImpl D/NetworkSecurityConfig: No Network Security Config specified, using platform default D/NetworkSecurityConfig: No Network Security Config specified, using platform default I/AGConnectProvider: AGConnectInitializeProvider#onCreate I/AGConnectInstance: AGConnectInstance#initialize I/HwApiCacheMangerEx: apicache path=/storage/emulated/0 state=mounted key=com.#10158#256 I/HwApiCacheMangerEx: need clear apicache,because volumes changed,oldCnt=0 newCnt=1 I/ServiceRegistrarParser: getServices I/ServiceRegistrarParser: services:0 I/HwApiCacheMangerEx: apicache path=/storage/emulated/0 state=mounted key=com.#10158#0 I/HwApiCacheMangerEx: need clear apicache,because volumes changed,oldCnt=1 newCnt=1 I/ActivityThread: finishPreloaded preloadStatus 0 I/HwPartIawareFactory: add android.common.HwPartIawareFactoryImpl to memory. I/AwareBitmapCacher: init processName:com. pid=3784 uid=10158 E/AwareLog: AtomicFileUtils: readFileLines file not exist: android.util.AtomicFile@763c7a9 V/ActivityThread: callActivityOnCreate I/DecorView[]: old windowMode:0 new windoMode:1 W/com.: Accessing hidden method Landroid/view/View;->computeFitSystemWindows(Landroid/graphics/Rect;Landroid/graphics/Rect;)Z (greylist, reflection, allowed) W/com.: Accessing hidden method Landroid/view/ViewGroup;->makeOptionalFitsSystemWindows()V (greylist, reflection, allowed) I/OverScrollerOptimization: start init SmartSlideOverScroller and get the overscroller config I/OverScrollerOptimization: get the overscroller config I/FactoryLoader: loadFactory() ClassNotFoundException ! D/ActivityThread: add activity client record, r= ActivityRecord{c0af659 token=android.os.BinderProxy@ca951d7 {com./com.huawei.hms.maps.sample.MainActivity}} token= android.os.BinderProxy@ca951d7 D/InputEventReceiver: dispatchInputInterval 0 W/HiTouch_HiTouchSensor: depended package hiTouch does n't exist! I/HiTouch_HiTouchSensor: HiTouch restricted: system app HiTouch don't exist. D/HiTouch_PressGestureDetector: onAttached, package=com., windowType=1, mHiTouchRestricted=true I/FrameFlow: FrameFlowInit app is not supported by frameflow solution I/iGraphics: [GetTotalMemory] total memory =5842124KB W/iGraphics: not MTK I/iGraphics: [0020080c] pn: com., p: 3784 I/com.: HwCustType is 0 E/com.: open file error I/com.: no cota live update cust policy found I/com.: GetCfgDirRealPolicyValue: custPolicyDirs: /system/magic/base:/system/magic/oversea:/system/magic/oversea_honor:/system/magic/lite:/vendor/etc:/odm/etc:/odm/hn_odm/TFY-L31CQ:/product_h/etc:/product_h/region_comm/oversea:/preas/oversea:/product_h/hn_oem/TFY-L31CQ:/preload/TFY-L31CQ/opr/eea:/cust/global:/cust/def/eu:/cust/def/eea:/version/cust/opr/eea:/product_h/special_cust/TFY-L31CQ/def/eu:/product_h/special_cust/TFY-L31CQ/def/eea:/product_h/special_cust/TFY-L31CQ/opr/eea:/version/special_cust/TFY-L31CQ/opr/eea:/cust/cotalite:/cust/ecota I/iGraphics: [0030080c] no spt app: com. I/AdrenoGLES-0: QUALCOMM build : 1a315fd02c, I090e68fbb7 Build Date : 12/01/21 OpenGL ES Shader Compiler Version: EV031.32.02.16 Local Branch : Remote Branch : Remote Branch : Reconstruct Branch : I/AdrenoGLES-0: Build Config : S P 10.0.7 AArch64 I/AdrenoGLES-0: Driver Path : /vendor/lib64/egl/libGLESv2_adreno.so I/AdrenoGLES-0: PFP: 0x016ee197, ME: 0x00000000 D/HwForceDark: [SetDarkThemeInfo] enable = [0], appType = [0], winWidth = [1080] I/HwViewRootImpl: removeInvalidNode jank list is null E/RtgSchedIpcFile: RtgSchedIpcFile failed to open /proc/3784/rtg I/RmeSchedManager: init Rme, version is: v1.0 E/RtgSchedIpcFile: RtgSchedIpcFile failed to open /proc/3784/rtg I/RmeSchedManager: init Rme, version is: v1.0 E/RtgSchedIpcFile: setCommandByIoctl not opened D/RtgSched: resetRtgSchedHandle failed enable:1 E/RtgSchedIpcFile: RtgSchedIpcFile failed to open /proc/3784/rtg I/RmeSchedManager: init Rme, version is: v1.0 E/RtgSchedIpcFile: setCommandByIoctl not opened D/RtgSched: resetRtgSchedHandle failed enable:0 D/ActivityThread: Won't deliver top position change in state=4 D/RenderService: RCS is disable I/HwViewRootImpl: removeInvalidNode all the node in jank list is out of time E/RtgSchedIpcFile: RtgSchedIpcFile failed to open /proc/3784/rtg I/RmeSchedManager: init Rme, version is: v1.0 E/RtgSchedIpcFile: setCommandByIoctl not opened D/RtgSched: resetRtgSchedHandle failed enable:1 D/DecorView: showOrHideHighlightView: hasFocus=true; winMode=1; isMrgNull=true W/InputMethodManager: startInputReason = 1 W/InputMethodManager: startInputReason = 6 I/AwareBitmapCacher: init lrucache size: 2097152 pid=3784 I/Hwaps: APS: EventAnalyzed: initAPS: version is 11.0.0.4 D/Hwaps: Fpsrequest create,type:EXACTLY_IDENTIFY D/Hwaps: Fpsrequest create,type:EXACTLY_IDENTIFY D/Hwaps: Fpsrequest create,type:OPENGL_SETTING D/Hwaps: FpsController create D/Hwaps: APS: EventAnalyzed: reInitFpsPara :mBaseFps = 90; mMaxFps = 90 W/HwApsManager: HwApsManagerService, registerCallback, start ! D/Hwaps: APS: EventAnalyzed: registerCallbackInApsManagerService, mPkgName:com.; result = true V/AudioManager: querySoundEffectsEnabled... I/MainActivity: onClick: BasicMap V/ActivityThread: callActivityOnCreate D/BasicMapDemoActivity: onCreate: I/DecorView[]: old windowMode:0 new windoMode:1 D/ActivityThread: add activity client record, r= ActivityRecord{7cef281 token=android.os.BinderProxy@38f40d7 {com./com.huawei.hms.maps.sample.BasicMapDemoActivity}} token= android.os.BinderProxy@38f40d7 D/InputEventReceiver: dispatchInputInterval 0 W/HiTouch_HiTouchSensor: depended package hiTouch does n't exist! I/HiTouch_HiTouchSensor: HiTouch restricted: system app HiTouch don't exist. D/HiTouch_PressGestureDetector: onAttached, package=com., windowType=1, mHiTouchRestricted=true D/DecorView: showOrHideHighlightView: hasFocus=false; winMode=1; isMrgNull=true D/DecorView: showOrHideHighlightView: hasFocus=true; winMode=1; isMrgNull=true W/InputMethodManager: startInputReason = 1 V/AudioManager: querySoundEffectsEnabled... D/BasicMapDemoActivity: createMapView: V/ActivityThread: callActivityOnCreate D/MapViewDemoActivity: onCreate: I/DecorView[]: old windowMode:0 new windoMode:1 W/HmsMapKit_MapsAdvUtil_48: The class:com.huawei.hms.maps.provider.inhuawei.MapViewDelegate not found. I/AGConnectInstance: AGConnectInstance#initialize W/AGConnectInstance: Repeated invoking initialize I/dynamic-api_DynamicModule: 3784-3784|null|com.huawei.hms.feature.dynamic.DynamicModule|queryHMSModuleBundle|114|bundle info: errorCode:0, moduleVersion:60600302, modulePath:/data/user_de/0/com.huawei.hwid/files/modules/external/huawei_module_maps/60600302/Map-Route.apk, loader_version:60600302, loaderPath:/data/user_de/0/com.huawei.hwid/files/modules/external/huawei_module_maps/60600302/Map-Route.apk, armeabiType:0 W/dynamic-api_DynamicModule: 3784-3784|null|com.huawei.hms.feature.dynamic.DynamicModule|b|95|The loader_path:/data/user_de/0/com.huawei.hwid/files/modules/external/huawei_module_maps/60600302/Map-Route.apk in query bundle is not available,change the module version to:-100 I/HmsMapKit_HmsUtil_69: get hms apk version : 0 fallbackVersion : 0 I/HmsMapKit_HmsUtil_169: hmsVersionStr 6.2.0.300 I/HmsMapKit_HmsUtil_197: baseVersion 60200300 I/HMSSDK_HMSPackageManager: aidlService pkgName: com.huawei.hwid I/HMSSDK_HMSPackageManager: Enter getHMSPackageNameForMultiService I/HMSSDK_HMSPackageManager: Succeed to find HMS apk: com.huawei.hwid version: 60700322 I/HMSSDK_HMSPackageManager: enter asyncOnceCheckMDMState I/HMSSDK_HMSPackageManager: enter checkHmsIsSpoof I/HMSSDK_HMSPackageManager: Enter getHMSPackageName I/HMSSDK_HMSPackageManager: Succeed to find HMS apk: com.huawei.hwid version: 60700322 I/HMSSDK_ReadApkFileUtil: verifyMDMSignatureV3 verify successful! I/HMSSDK_HMSPackageManager: quit checkHmsIsSpoof state: SUCCESS I/HMSSDK_HMSPackageManager: quit asyncOnceCheckMDMState I/HMSSDK_HMSPackageManager: enter checkHmsIsSpoof I/HMSSDK_HMSPackageManager: quit checkHmsIsSpoof cached state: SUCCESS I/HMSSDK_HMSPackageManager: Enter getHMSPackageName I/HmsMapKit_AvailableAdapter_31: current versionCode:60700322, minimum version requirements: 60200300 I/HMSSDK_HMSPackageManager: Enter getHMSPackageName I/HMSSDK_HMSPackageManager: Enter getHMSPackageName I/HmsMapKit_HmsUtil_226: Hms is :0 I/HmsMapKit_HmsUtil_235: Hms is avaiable I/AGConnectInstance: AGConnectInstance#initialize W/AGConnectInstance: Repeated invoking initialize E/HmsMapKit_MapView_119: createDelegate: creator == null I/HmsMapKit_AbsDeferredLifecycleHelper_28: getCreator: createdFlag = false I/HmsMapKit_AbsDeferredLifecycleHelper_103: getCreator: execute I/HmsMapKit_MapView_23: getMapAsync: getDelegate = null I/HmsMapKit_MapCreator_16: Making Creator dynamically I/HmsMapKit_MapView_60: getMapAsync: mapReadyCallbacks.size = 1 I/HmsMapKit_DynamicUtil_31: isFlyingSkyDevice extChannel: UNKNOWN D/ActivityThread: add activity client record, r= ActivityRecord{e65b096 token=android.os.BinderProxy@b55baba {com./com.huawei.hms.maps.sample.MapViewDemoActivity}} token= android.os.BinderProxy@b55baba I/HmsMapKit_DynamicUtil_121: isHuaweiPhone : true E/HmsMapKit_DynamicUtil_83: ClassNotFoundException: I/HmsMapKit_DynamicUtil_105: emuiVersionCodeValue: 0 E/HmsMapKit_DynamicUtil_78: ClassNotFoundException: I/HmsMapKit_DynamicUtil_100: emuiVersionCodeValue: 0 I/AGConnectInstance: AGConnectInstance#initialize W/AGConnectInstance: Repeated invoking initialize E/HmsMapKit_MapView_119: createDelegate: creator == null I/HmsMapKit_AbsDeferredLifecycleHelper_28: getCreator: createdFlag = true I/AGConnectInstance: AGConnectInstance#initialize W/AGConnectInstance: Repeated invoking initialize E/HmsMapKit_MapView_119: createDelegate: creator == null I/HmsMapKit_AbsDeferredLifecycleHelper_28: getCreator: createdFlag = true I/dynamic-api_DynamicModule: 3784-4249|null|com.huawei.hms.feature.dynamic.DynamicModule|queryHMSModuleBundle|114|bundle info: errorCode:0, moduleVersion:10023300, modulePath:/data/user_de/0/com.huawei.hwid/files/modules/external/huawei_module_dynamicloader/10023300/DynamicLoader.apk, loader_version:10023300, loaderPath:/data/user_de/0/com.huawei.hwid/files/modules/external/huawei_module_dynamicloader/10023300/DynamicLoader.apk, armeabiType:0 W/dynamic-api_AssetLoadManager: 3784-4249|null|com.huawei.hms.feature.dynamic.AssetLoadManager|b|170|No module apk in asset path. I/dynamic-api_DynamicModule: 3784-4249|null|com.huawei.hms.feature.dynamic.DynamicModule|a|180|HMS loader version:10023300, asset loader version:0 I/dynamic-api_DynamicModule: 3784-4249|null|com.huawei.hms.feature.dynamic.DynamicModule|a|191|Choose dynamicLoader in HMS. I/dynamic-api_DynamicModule: 3784-4249|null|com.huawei.hms.feature.dynamic.DynamicModule|a|234|HMS dynamicloader is not available, choose assets loader as default. I/dynamic-api_DynamicModule: 3784-4249|null|com.huawei.hms.feature.dynamic.DynamicModule|a|13|Load start in new-version-policy. I/dynamic-api_DynamicModule: 3784-4249|null|com.huawei.hms.feature.dynamic.DynamicModule|a|45|The loader path for module:huawei_module_maps is:null, and versionType is:2 E/HmsMapKit_MapCreator_60: Loading mapRoute dynamically failed, exception is Cannot find a valid dynamic loader in HMS or local. E/HmsMapKit_MapCreator_205: getRemoteContext: LoadingException: bundle = null, and retryCount is 0 D/InputEventReceiver: dispatchInputInterval 0 W/HiTouch_HiTouchSensor: depended package hiTouch does n't exist! I/HiTouch_HiTouchSensor: HiTouch restricted: system app HiTouch don't exist. D/HiTouch_PressGestureDetector: onAttached, package=com.***, windowType=1, mHiTouchRestricted=true D/DecorView: showOrHideHighlightView: hasFocus=false; winMode=1; isMrgNull=true D/DecorView: showOrHideHighlightView: hasFocus=true; winMode=1; isMrgNull=true W/InputMethodManager: startInputReason = 1 E/HmsMapKit_DynamicUtil_83: ClassNotFoundException: I/HmsMapKit_DynamicUtil_105: emuiVersionCodeValue: 0 E/HmsMapKit_DynamicUtil_78: ClassNotFoundException: I/HmsMapKit_DynamicUtil_100: emuiVersionCodeValue: 0

xuxiapu commented 1 year ago

Dear developer, Generally, ClassNotFoundException errors occur because confusion scripts are not added. You can view this document for details.

mcmadsen commented 1 year ago

Thankyou - I've tried enabling proguard (it is disabled in your java example) - but then I get the following warnings instead (and still the same ClassNotFoundException).

Task :app:minifyDebugWithR8 AGPBI: {"kind":"warning","text":"Missing classes detected while running R8. Please add the missing classes or apply additional keep rules that are generated in /Users/mads-christianmadsen/Downloads/hms-mapkit-demo-master/java/app/build/outputs/mapping/debug/missing_rules.txt.\n","sources":[{}]} AGPBI: {"kind":"warning","text":"Missing class android.telephony.HwTelephonyManager (referenced from: java.lang.String com.huawei.hms.framework.common.NetworkUtil.getNetWorkNSAorSA())\nMissing class com.huawei.android.os.BuildEx$VERSION (referenced from: int com.huawei.hms.framework.common.NetworkUtil.getHwNetworkType(android.content.Context))\nMissing class com.huawei.android.telephony.ServiceStateEx (referenced from: int com.huawei.hms.framework.common.NetworkUtil.getHwNetworkType(android.content.Context))\nMissing class com.huawei.hianalytics.process.HiAnalyticsConfig$Builder (referenced from: void com.huawei.hms.utils.HMSBIInitializer$a.onCallBackSuccess(java.lang.String))\nMissing class com.huawei.hianalytics.process.HiAnalyticsConfig (referenced from: void com.huawei.hms.utils.HMSBIInitializer$a.onCallBackSuccess(java.lang.String))\nMissing class com.huawei.hianalytics.process.HiAnalyticsInstance$Builder (referenced from: void com.huawei.hms.utils.HMSBIInitializer$a.onCallBackSuccess(java.lang.String))\nMissing class com.huawei.hianalytics.process.HiAnalyticsInstance (referenced from: com.huawei.hianalytics.process.HiAnalyticsInstance com.huawei.hms.framework.common.hianalytics.HianalyticsHelper.defaultInstance and 13 other contexts)\nMissing class com.huawei.hianalytics.process.HiAnalyticsManager (referenced from: void com.huawei.hms.framework.common.hianalytics.HianalyticsHelper.() and 5 other contexts)\nMissing class com.huawei.hianalytics.util.HiAnalyticTools (referenced from: void com.huawei.hms.support.hianalytics.HiAnalyticsUtils.enableLog(android.content.Context))\nMissing class com.huawei.hms.maps.auth.AuthClient (referenced from: void com.huawei.hms.maps.MapFragment.onCreate(android.os.Bundle) and 5 other contexts)\nMissing class com.huawei.hms.maps.provider.inhuawei.IDistanceCalculatorDelegate (referenced from: double com.huawei.hms.maps.common.util.mab.a(com.huawei.hms.maps.model.LatLng, com.huawei.hms.maps.model.LatLng))\nMissing class com.huawei.hms.maps.provider.inhuawei.IHuaweiMapDelegate (referenced from: void com.huawei.hms.maps.MapFragment$mab$1.onMapReady(com.huawei.hms.maps.internal.IHuaweiMapDelegate) and 3 other contexts)\nMissing class com.huawei.hms.maps.provider.inhuawei.MapFragmentDelegate (referenced from: void com.huawei.hms.maps.MapFragment$mab.a() and 1 other context)\nMissing class com.huawei.hms.maps.provider.inhuawei.MapViewDelegate (referenced from: com.huawei.hms.maps.internal.IMapViewDelegate com.huawei.hms.maps.MapView$maa.a(com.huawei.hms.maps.internal.ICreator, android.content.Context, com.huawei.hms.maps.HuaweiMapOptions) and 3 other contexts)\nMissing class com.huawei.libcore.io.ExternalStorageFile (referenced from: java.io.File com.huawei.hms.framework.common.CreateFileUtil.newFile(java.lang.String))\nMissing class com.huawei.libcore.io.ExternalStorageFileInputStream (referenced from: java.io.FileInputStream com.huawei.hms.framework.common.CreateFileUtil.newFileInputStream(java.lang.String))\nMissing class com.huawei.libcore.io.ExternalStorageFileOutputStream (referenced from: java.io.FileOutputStream com.huawei.hms.framework.common.CreateFileUtil.newFileOutputStream(java.io.File))\nMissing class com.huawei.libcore.io.ExternalStorageRandomAccessFile (referenced from: java.io.RandomAccessFile com.huawei.hms.framework.common.CreateFileUtil.newRandomAccessFile(java.lang.String, java.lang.String))\nMissing class com.huawei.secure.android.common.util.SafeBase64 (referenced from: byte[] com.huawei.hms.framework.common.SecurityBase64Utils.decode(java.lang.String, int) and 1 other context)\nMissing class com.huawei.secure.android.common.util.SafeString (referenced from: java.lang.String com.huawei.hms.framework.common.StringUtils.replace(java.lang.String, java.lang.CharSequence, java.lang.CharSequence) and 2 other contexts)\nMissing class org.bouncycastle.crypto.BlockCipher (referenced from: java.security.SecureRandom com.huawei.secure.android.common.encrypt.utils.EncryptUtil.a())\nMissing class org.bouncycastle.crypto.engines.AESEngine (referenced from: java.security.SecureRandom com.huawei.secure.android.common.encrypt.utils.EncryptUtil.a())\nMissing class org.bouncycastle.crypto.prng.SP800SecureRandom (referenced from: java.security.SecureRandom com.huawei.secure.android.common.encrypt.utils.EncryptUtil.a())\nMissing class org.bouncycastle.crypto.prng.SP800SecureRandomBuilder (referenced from: java.security.SecureRandom com.huawei.secure.android.common.encrypt.utils.EncryptUtil.a())","sources":[{}],"tool":"R8"}

mcmadsen commented 1 year ago

Update: To make the sample work, I had to add the following code to build.gradle in app folder


android {
  defaultConfig {
      ...
      multiDexEnabled = true
  }
}

dependencies {
  implementation("androidx.multidex:multidex:2.0.1")
  ...
   implementation 'com.huawei.hms:maps-basic:6.5.0.301'
}

And to AndroidManifest a missing permission: <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>

But it should work without it right?

xuxiapu commented 1 year ago

@mcmadsen Hi!

  1. What will happen if this permission is not added to the project? Will the map fail to load?
  2. Could you send out your project permission list?
  3. If ACCESS is not added WIFI If the map cannot be loaded with the STATE permission, can you also send a log?

Log extraction method:

  1. Adb connects the mobile phone and executes the following commands: adb logcat –v time > D:\map.log.
  2. Repeat the problem scenario.
  3. Press Ctrl+c to finish.