HarmonyOS 鸿蒙Next 官方例程指南针在手机可正常使用在华为平板无法使用
HarmonyOS 鸿蒙Next 官方例程指南针在手机可正常使用在华为平板无法使用 官方例程,compass(java),在手机上(nove6 5g 鸿蒙os 3.0)可以正常使用,会显示角度。在平板(华为matepad 11 鸿蒙os 3.0)可以运行,但是不会显示角度。
尝试在config.josn里面增加:
"reqPermissions": [
{"name": "ohos.permission.GYROSCOPE"},
{"name": "ohos.permission.ACCELEROMETER"}
],
还是无法正常。
使用 java api v6,重新写了,还是手机可以支持使用。平板不会显示角度。看debug的红字部分,大致知道意思应该是无法获取到传感器。但不知道怎么解决。
这个问题困扰我很久,很希望可以有大佬可以帮忙解决。十分感谢,刚接触鸿蒙,找了很久的资料。实在不知道怎么解决。中途都想放弃了。但还是不死心。所以还是很希望有人可以帮忙解答。
关键的debug信息主要有:
I/BehaviorCollectManager: don't match ai support or app dynamic detection condition
E/BehaviorCollectManager: Fail to acquire dataAnalyzerService...
E/AwareLog: AtomicFileUtils: readFileLines file not exist: android.util.AtomicFile[@1a1ee49](/user/1a1ee49)
E/libdnetwork: binder invoke failed:err code -129
E/InputTransport: channel '5fdd2ab ohos.samples.compass/ohos.samples.compass.PageAbilityShellActivity (client)' ~ receive message failed, errno=11, seq = 828030
E/InputTransport: channel '5fdd2ab ohos.samples.compass/ohos.samples.compass.PageAbilityShellActivity (client)' ~ receive message failed, errno=11, seq = 828031
W/SurfaceView: notifySurfaceDestroyed
debug信息如下:
03/11 23:52:26: Launching ohos.samples.compass
$hdc shell am force-stop ohos.samples.compass
$hdc shell bm uninstall ohos.samples.compass
$hdc file send D:\DevStudioProjects\samples-master\device\Compass\entry\build\outputs\hap\debug\entry-debug-rich-signed.hap /sdcard/83a6882e1fbd43bf9981ae41f9f6abcf/entry-debug-rich-signed.hap
$hdc shell bm install -p /sdcard/83a6882e1fbd43bf9981ae41f9f6abcf/
$hdc shell rm -rf /sdcard/83a6882e1fbd43bf9981ae41f9f6abcf
$hdc shell am start -n "ohos.samples.compass/ohos.samples.compass.PageAbilityShellActivity" -D
Waiting for application to come online: ohos.samples.compass
Connecting to ohos.samples.compass
Capturing and displaying logcat messages from application. This behavior can be disabled in the "Logcat Output" section of the "Debugger" settings page.
D/CompatibilityChangeReporter: Compat change id reported: 171979766; UID 10281; state: DISABLED
I/Typeface: fontManager.getInitFontWeightScale:1.0
W/ActivityThread: Application ohos.samples.compass is waiting for the debugger on port 8100...
I/System.out: Sending WAIT chunk
I/ActivityThread: Init compatible state: true
D/HwFrameworkSecurityPartsFactory: HwFrameworkSecurityPartsFactory in.
I/HwFrameworkSecurityPartsFactory: add HwFrameworkSecurityPartsFactory to memory.
I/BehaviorCollectManager: don't match ai support or app dynamic detection condition
E/BehaviorCollectManager: Fail to acquire dataAnalyzerService...
I/System.out: Debugger has connected
I/System.out: waiting for debugger to settle...
Connected to the target VM, address: 'localhost:18600', transport: 'socket'
I/System.out: waiting for debugger to settle...
I/System.out: waiting for debugger to settle...
I/System.out: waiting for debugger to settle...
I/System.out: waiting for debugger to settle...
I/System.out: waiting for debugger to settle...
I/System.out: waiting for debugger to settle...
I/System.out: waiting for debugger to settle...
I/System.out: debugger has settled (1429)
I/LoadedApk: createSharedLibrariesLoaders::sharedLibraries is [SharedLibraryInfo{name:android.test.base, type:builtin, version:-1}]
createSharedLibrariesLoaders::sharedLibraries is null
D/ApplicationLoaders: Returning zygote-cached class loader: /system/framework/android.test.base.jar
I/ApplicationLoaders: getSharedLibraryClassLoaderWithSharedLibraries::loader is dalvik.system.PathClassLoader[DexPathList[[zip file "/system/framework/android.test.base.jar"],nativeLibraryDirectories=[/system/lib64, /system/system_ext/lib64, /hw_product/lib64, /system/lib64/module/multimedia]]]
W/samples.compas: JIT profile information will not be recorded: profile file does not exist.
I/HwApiCacheMangerEx: apicache path=/storage/emulated/0 state=mounted key=ohos.samples.compass#10281#256
I/HwApiCacheMangerEx: apicache path=/storage/9C33-6BBD state=mounted key=ohos.samples.compass#10281#256
need clear apicache,because volumes changed,oldCnt=0 newCnt=2
V/GraphicsEnvironment: ANGLE Developer option for 'ohos.samples.compass' set to: 'default'
I/HwApiCacheMangerEx: apicache path=/storage/emulated/0 state=mounted key=ohos.samples.compass#10281#0
I/HwApiCacheMangerEx: apicache path=/storage/9C33-6BBD state=mounted key=ohos.samples.compass#10281#0
V/GraphicsEnvironment: Updatable production driver is not supported on the device.
I/HwApiCacheMangerEx: need clear apicache,because volumes changed,oldCnt=2 newCnt=2
D/NetworkSecurityConfig: No Network Security Config specified, using platform default
D/NetworkSecurityConfig: No Network Security Config specified, using platform default
I/AwareBitmapCacher: init processName:ohos.samples.compass pid=14317 uid=10281
I/libdnetwork: binder is null or is not alive, get servcie from service manager
E/AwareLog: AtomicFileUtils: readFileLines file not exist: android.util.AtomicFile[@1a1ee49](/user/1a1ee49)
E/libdnetwork: binder invoke failed:err code -129
I/HwTypeface: updateFont: scale=1.0
I/ActivityThread: finishPreloaded preloadStatus 0
I/LaunchActivityItem: execute start, token = android.os.BinderProxy[@f11213](/user/f11213)
D/OpenGLRenderer: disableOutlineDraw is true
I/OpenGLRenderer: RenderThread: progress name = [ohos.samples.compass], viewCornerType = 0, g2param1 = 0.000000, g2param2 = 0.000000
I/iGraphics: [0020080c] pn: ohos.samples.compass, p: 14317
[0030080c] no spt app: ohos.samples.compass
V/ActivityThread: callActivityOnCreate
I/SystemFonts: custom xml:/system/etc/fonts_tablet.xml
I/HwMediaViewLayoutChangeHandler: attachLayoutChangeListener: attached listener to view=ohos.agp.window.aspbshell.AGPContainerView{b8e46a4 V.E...... ......I. 0,0-0,0}
I/DecorView: navBarColor: 0 statusBarColor: 0 statusInsets: null navInsets: null
updateColorViewInt type:1 size: 0 showView:false color:ff000000
I/DecorView: updateColorViewInt type:0 size: 0 showView:false color:ff000000
navBarColor: 0 statusBarColor: 0 statusInsets: null navInsets: null
updateColorViewInt type:1 size: 0 showView:false color:ff000000
updateColorViewInt type:0 size: 0 showView:false color:ff000000
I/DecorView: navBarColor: fffcfcfc statusBarColor: ff191c1e statusInsets: null navInsets: null
updateColorViewInt type:1 size: 0 showView:false color:fffcfcfc
I/DecorView: updateColorViewInt type:0 size: 0 showView:false color:ff191c1e
navBarColor: fffcfcfc statusBarColor: ff191c1e statusInsets: null navInsets: null
updateColorViewInt type:1 size: 0 showView:false color:fffcfcfc
updateColorViewInt type:0 size: 0 showView:false color:ff191c1e
I/DecorView: navBarColor: fffcfcfc statusBarColor: ff191c1e statusInsets: Insets{left=0, top=61, right=0, bottom=0} navInsets: Insets{left=0, top=0, right=0, bottom=0}
updateColorViewInt type:1 size: 0 showView:false color:fffcfcfc
updateColorViewInt type:0 size: 61 showView:true color:ff191c1e
D/BufferQueueCore: BufferQueueCore: mDebugHwFlow=0, mIsBufferQueueLogVSupport=0.
D/InsetsSourceConsumer: setControl mType:0, requestedVisible:true, getLeash:null, needAnimation:false, mIsAnimationPending:false, getRootViewTitle:ohos.samples.compass/ohos.samples.compass.PageAbilityShellActivity
I/AdrenoGLES-0: QUALCOMM build : 5ac347592d, I5b26abddf4
Build Date : 12/24/21
OpenGL ES Shader Compiler Version: EV031.32.02.17
Local Branch :
Remote Branch :
Remote Branch :
Reconstruct Branch :
Build Config : S P 10.0.7 AArch64
Driver Path : /vendor/lib64/egl/libGLESv2_adreno.so
I/RmeSchedManager: init Rme, version is: v1.0
I/RtgSchedEvent: current pid:14317 AppType:-1
I/AdrenoGLES-0: PFP: 0x016dd093, ME: 0x00000000
I/OpenGLRenderer: CacheManager width 1600, height 2560
D/hw-ProcessState: Binder ioctl to enable oneway spam detection failed: Invalid argument
D/BufferQueueCore: BufferQueueCore: mDebugHwFlow=0, mIsBufferQueueLogVSupport=0.
I/SurfaceView: setLowResolutionInfo compatInfo.supportsScreen() is not satisfied
W/HwApsImpl: not support full screen video recognize feature ## ohos.samples.compass
I/HwViewRootImpl: removeInvalidNode jank list is null
E/InputTransport: channel '5fdd2ab ohos.samples.compass/ohos.samples.compass.PageAbilityShellActivity (client)' ~ receive message failed, errno=11, seq = 828030
D/InsetsS
ourceConsumer: setControl mType:0, requestedVisible:true, getLeash:Surface(name=Surface(name=ed6722e StatusBar)/[@0xc87d628](/user/0xc87d628) - animation-leash of insets_animation)/[@0x911f682](/user/0x911f682), needAnimation:false, mIsAnimationPending:false, getRootViewTitle:ohos.samples.compass/ohos.samples.compass.PageAbilityShellActivity
I/HwMediaViewLayoutChangeHandler: handleMediaViewLayoutChanged, listener removed. view=ohos.agp.window.aspbshell.AGPContainerView{b8e46a4 VFE...... .F...... 0,0-1600,2336}
W/InputMethodManager: startInputReason = 1
W/HwRemoteInputMethodManager: isCasting false because IHwDistributedWindowManager is invalid.
W/InputMethodManager: startInputReason = 6
I/AwareBitmapCacher: init lrucache size: 4194304 pid=14317
更多关于HarmonyOS 鸿蒙Next 官方例程指南针在手机可正常使用在华为平板无法使用的实战教程也可以访问 https://www.itying.com/category-93-b0.html
您好,您的问题需要进一步定位,请您通过在线提单进一步解决:https://developer.huawei.com/consumer/cn/support/feedback/#/,感谢您的反馈和支持。
更多关于HarmonyOS 鸿蒙Next 官方例程指南针在手机可正常使用在华为平板无法使用的实战系列教程也可以访问 https://www.itying.com/category-93-b0.html
谢谢版主,已经提交,
我进一步研发现了问题,但是我不知道怎么解决。问题描述在3楼,您再帮忙给看看。
骁龙传感器好像都不行,麒麟可以
对不起,您提供的HTML内容中没有包含任何需要转换的信息。请提供包含文本和可能的图片的HTML代码,以便我可以帮助您将其转换为Markdown格式。
我也没找到解决方案。
提交了问题。我后面又进一步研究,发现了问题,但不知道怎么解决
开发工具:devEco studio 3.0 ,java ,api6
测试机器matepad 11 鸿蒙OS 3.0
public void onStart(Intent intent) {
super.onStart(intent);
super.setUIContent(ResourceTable.Layout_ability_main);
text=(Text) findComponentById(ResourceTable.Id_text_helloworld);
categoryOrientationAgent=new CategoryOrientationAgent();
categoryOrientation= categoryOrientationAgent.getSingleSensor(CategoryOrientation.SENSOR_TYPE_ORIENTATION);
if(categoryOrientation!=null) {
text.setText(categoryOrientation.getName());
} else {
text.setText("is null");
}
}
上述源码,在nova6 5g,可以获取的到,但是在matepad11 无法获取到传感器。能帮我解答一下吗。盼复。
针对帖子标题“HarmonyOS 鸿蒙Next 官方例程指南针在手机可正常使用在华为平板无法使用”的问题,可能的原因及解决方案如下:
-
传感器差异:手机和华为平板在硬件配置上可能存在差异,特别是磁力计(指南针功能依赖的传感器)。某些平板型号可能未配备磁力计或磁力计性能不佳,导致指南针功能无法正常工作。
-
权限设置:请检查平板上的应用权限设置,确保指南针应用已获取必要的传感器访问权限。
-
系统适配问题:鸿蒙系统在不同设备上可能存在适配问题。官方例程可能未完全适配所有平板型号,导致功能异常。
-
软件bug:指南针功能可能受到鸿蒙系统或指南针应用本身bug的影响。请检查是否有可用的系统更新或应用更新,并尝试安装。
-
环境干扰:平板所处的环境可能对磁力计产生干扰,如强磁场、电子设备等。尝试在不同环境下使用指南针功能,观察是否有所改善。
如果以上方法均未能解决问题,请考虑联系华为官方客服进行进一步咨询。官网客服地址是:https://www.itying.com/category-93-b0.html 如果问题依旧没法解决请联系官网客服。