搜索
查看
编辑修改
首页
UNITY
NODEJS
PYTHON
AI
GIT
PHP
GO
CEF3
JAVA
HTML
CSS
搜索
我家小花儿
这个屌丝很懒,什么也没留下!
关注作者
热门标签
jquery
HTML
CSS
PHP
ASP
PYTHON
GO
AI
C
C++
C#
PHOTOSHOP
UNITY
iOS
android
vue
xml
爬虫
SEO
LINUX
WINDOWS
JAVA
MFC
CEF3
CAD
NODEJS
GIT
Pyppeteer
article
热门文章
1
数据结构与算法笔记-----动态规划简述(以Coin change为例图示+C语言实现)_coinchange控制流图
2
数据类型——枚举_枚举类型
3
2023年小美赛认证杯国际赛C题赛题_2023年认证杯小美赛c题
4
Docker详解(五)——Docker基本使用_docker使用
5
Kafka系列之:日志清理_kafka日志清理
6
优化VMware虚拟机里的MacOS系统_vm装macos不流畅
7
bat内部命令4:copy_bat copy
8
docker-compose_extra_hosts
9
创建AWS ECS Fargate
10
iftop 监控linux,centos服务器网络流量
当前位置:
article
> 正文
Could not find method问题解决_could not find method namespace() for arguments [c
作者:我家小花儿 | 2024-02-17 03:09:21
赞
踩
could not find method namespace() for arguments [com.benjaminabel.vibration]
有时候需要把代码制作成jar包放入到项目中,如果只是一个普通的java文件导入系统都是没有问题的,但是很有可能需要将service导出jar包到,由系统启动。
1.通常只需要修改SystemService.java,比如jar包为AutoService_v0.1.jar,把该文件拷贝到framework/base/services/java/目录下。
2.修改framework/base/services/java目录下的Android.mk文件,这样才会编译到系统,通常都是编译到services.java里面,这不是绝对的。
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES := AutoService:AutoService_v0.1.jar
include $(BUILD_MULTI_PREBUILT)
# the library
# ============================================================
include $(CLEAR_VARS)
LOCAL_SRC_FILES := \
$(call all-subdir-java-files) \
com/android/server/EventLogTags.logtags \
com/android/server/am/EventLogTags.logtags
LOCAL_SRC_FILES += $(call all-Iaidl-files-under,com)
LOCAL_MODULE:= services
LOCAL_JAVA_LIBRARIES := android.policy conscrypt telephony-common
AutoService
include $(BUILD_JAVA_LIBRARY)
include $(BUILD_DROIDDOC)
3.启动autoservice,这时需要修改SystemService.java,修改如下。
4.最后是编译,我们可以用mmm方式进行编译,这样会节省编译时间。
mmm framework/base/services/java
mmm编译生成services.jar文件,把该文件push到机器的/system/framework目录下,重启机器。也许你会有很大的惊喜,也许会让你失望。不过没关系,办法总是有的。
5.下面来看看错误信息
D/SensorService( 2614): nuSensorService thread starting...
I/dalvikvm( 2614): Could not find method com.semisky.autoservice.services.AutoService.getInstance, referenced from method com.android.server.ServerThread.initAndLoop
W/dalvikvm( 2614): VFY: unable to resolve static method 14434: Lcom/semisky/autoservice/services/AutoService;.getInstance ()Lcom/semisky/autoservice/services/AutoService;
D/dalvikvm( 2614): VFY: replacing opcode 0x71 at 0x0753
I/installd( 2253): new connection
...
...
I/SystemServer( 2614): Print AutoService
W/SystemServer( 2614): ***********************************************
F/SystemServer( 2614): BOOT FAILURE starting AutoService
F/SystemServer( 2614): java.lang.NoClassDefFoundError: com.semisky.autoservice.services.AutoService
F/SystemServer( 2614): at com.android.server.ServerThread.initAndLoop(SystemServer.java:817)
F/SystemServer( 2614): at com.android.server.SystemServer.main(SystemServer.java:1191)
F/SystemServer( 2614): at java.lang.reflect.Method.invokeNative(Native Method)
F/SystemServer( 2614): at java.lang.reflect.Method.invoke(Method.java:515)
F/SystemServer( 2614): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
F/SystemServer( 2614): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
F/SystemServer( 2614): at dalvik.system.NativeStart.main(Native Method)
上面的错误信息让人头痛,从字面意思来看说是找不到
com.semisky.autoservice.services.AutoService.getInstance
方法,其实AutoService里面是有getInstance方法的。
6.解决办法
将Android.mk文件改成如下,重新编译push到机器上,解决此问题。
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES := AutoService:AutoService_v0.1.jar
include $(BUILD_MULTI_PREBUILT)
# the library
# ============================================================
include $(CLEAR_VARS)
LOCAL_SRC_FILES := \
$(call all-subdir-java-files) \
com/android/server/EventLogTags.logtags \
com/android/server/am/EventLogTags.logtags
LOCAL_SRC_FILES += $(call all-Iaidl-files-under,com)
LOCAL_MODULE:= services
LOCAL_JAVA_LIBRARIES := android.policy conscrypt telephony-common
LOCAL_STATIC_JAVA_LIBRARIES := AutoService
include $(BUILD_JAVA_LIBRARY)
include $(BUILD_DROIDDOC)
声明:
本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:
https://www.wpsshop.cn/w/我家小花儿/article/detail/99482
推荐阅读
article
ubun
t
u
16.04搭建
py
t
hon
开发环境
sublime
t
es
t
3_/usr/bin/py
t
...
本来是想用pycharm,但你看它的内存要求,我的虚拟机一共也就1GVim太别扭了,就算有代码颜色,不能自动对齐,不能规...
赞
踩
article
论文阅读 :A survey of
visual
an
alytics
techniques for ...
A survey of
visual
an
alytics
techniques for
machine
learning
...
赞
踩
article
Dockerhub容器信息获取_use
image
_
filter
to
find
official
...
由于毕业设计需要分析容器信息,一开始采取爬虫获取dockerhub网站发现那些想要的信息是异步加载的,遂抓包拿到具体的内...
赞
踩
article
Django
报错:
Page
not
found
(404)
Request
Method: GETRe...
解决
Django
报错 Using the URLconf defined in mysite.urls,
Django
...
赞
踩
article
关于
Error
:
Cannot
find
module
‘
webpack
/
lib
/RuleSet‘...
关于
Error
:
Cannot
find
module
‘
webpack
/
lib
/RuleSet‘ 的详细解决方法(亲...
赞
踩
article
Find
whether
a
given
number
is
a
power
of
4 or not...
reference: http://www.geeksforgeeks.org/find-
whether
-a-
given
...
赞
踩
article
Android
Studio
报错:Error:
Could
not find
com
.
android
....
看字面意思,这个问题是Gradle没有对应版本。在搜索引擎失效之后,尝试自己解决。 有一点很重要,先保证自己的Andro...
赞
踩
article
解决 Could not
find
com
.
android
.
tools
.
build
:
gradle
问...
Error:Could not
find
com
.
android
.
tools
.
build
:
gradle
:3.4.0htt...
赞
踩
article
解决Stable Diffusion TensorRT转换模型报错cpu and
cuda
:0! (...
覆盖extensions\stable-diffusion-webui-tensorrt里的export_onnx.py...
赞
踩
article
Ue4
随笔——
Find
Collision
UV_正在
调用
findcollisionuv
...
**
Find
Collision
UV**一,项目设置二,在第一人称蓝图中
调用
注意红色箭头标注的地方, 此方法是最稳定和...
赞
踩
article
Vue如何使用
Vant
ui进行快速开发_cannot
find
module
'
postcss
-p...
Vant
是一款轻量、可靠的组件库。能够大大提高我们的开发速度。这里使用的是vant2_cannot
find
modul...
赞
踩
article
Unity
之
GameObject
类_
unity
gamobject
.find...
GameObject
.Find: 用于查找游戏对象,我们结合代码进行理解:
GameObject
cube;cube=Ga...
赞
踩
article
Linux
network
namespace
访问外网以及多命名
空间通信
(经典容器组网
veth
...
整理K8s网络相关笔记博文内容涉及
Linux
network
namespace
访问外网方案 Demo实际上也就是经...
赞
踩
article
open3d
安装的诸多问题_
error
: could not
find
a
version
that
...
open3d
安装使用中遇到的问题以及最后如何成功使用_
error
: could not
find
a
version
t...
赞
踩
article
Android
7.0
Nougat(牛轧糖)---对
开发者
来说_
overrides
depreca...
android
7.0
出来了。让你的app准备迎接最新的
android
版本吧,支持节省电量和内存,这样新的系统行为。使用...
赞
踩
article
错误处理:
could
not
find
the
main
class
,
Program
will
e...
1. 先检查环境变量配置是否有错。a) 打开我的电脑--属性--高级--环境变量b) 新建系统变量JAVA_HOME和C...
赞
踩
article
Gradle项目运行报错
Could
not
find
method
XXX及解决方案_
gradle
...
Could
not
find
method
testCompile() for argumentsdependencie...
赞
踩
相关标签
python
机器学习
视觉分析
django
webpack
前端
node.js
Android
gradle
报错
深度学习
pytorch
vue.js
ui
html
unity
c#
游戏引擎
linux
php
运维
android
扩展
开发人员