@weijiz 我的程序也跑通了,是一个设置出了问题,修改过程是:
打开IDE,进入File—>Setting—>Build,Execution,Deployment—>Instant Run
将将enable instant run to hot swap code/resource changes on deploy勾上!
ROS Group 产品服务
Product Service 开源代码库
Github 官网
Official website 技术交流
Technological exchanges 激光雷达
LIDAR ROS教程
ROS Tourials 深度学习
Deep Learning 机器视觉
Computer Vision
BITLiuYu 发布的帖子
-
RE: 在Android中使用ROS
-
RE: 在Android中使用ROS
@weijiz 这是我上传到github上的代码
https://github.com/BITLiuYu/ROSTest.git
多谢您能帮我看一下 -
RE: 在Android中使用ROS
@weijiz 可以运行自带的HelloWorld,但是改为您写的MainActivity就会闪退,URI.create我已经改为自己的ip地址了。logcat错误信息为:
10-15 17:16:56.627 32148-32148/org.bwbot.rostest E/AndroidRuntime: FATAL EXCEPTION: main
Process: org.bwbot.rostest, PID: 32148
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{org.bwbot.rostest/org.bwbot.rostest.MainActivity}: java.lang.IllegalAccessException: void org.bwbot.rostest.MainActivity.() is not accessible from java.lang.Class<android.app.AppComponentFactory>
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2843)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6669)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Caused by: java.lang.IllegalAccessException: void org.bwbot.rostest.MainActivity.() is not accessible from java.lang.Class<android.app.AppComponentFactory>
at java.lang.Class.newInstance(Native Method)
at android.app.AppComponentFactory.instantiateActivity(AppComponentFactory.java:69)
at android.app.Instrumentation.newActivity(Instrumentation.java:1215)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2831)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6669)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858) -
RE: 在Android中使用ROS
我的系统是Ubuntu,所有的设置也是按照您的教程做的,但是run的时候就立即闪退。
其中,修改app的build.gradle时出现错误:Error:Conflict with dependency 'com.google.code.findbugs:jsr305' in project ':app'. Resolved versions for app (1.3.9) and test app (2.0.1) differ. See http://g.co/androidstudio/app-test-app-conflict for details.
按照网上的方式,进行修改,在Android节点下添加:
configurations.all { resolutionStrategy.force 'com.google.code.findbugs:jsr305:1.3.9' }
不知道是否会影响
我的build.gradle为:
apply plugin: 'com.android.application' android { compileSdkVersion 25 //buildToolsVersion '25.0.0' defaultConfig { applicationId "com.example.rostest" minSdkVersion 15 targetSdkVersion 25 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } productFlavors { } configurations.all { resolutionStrategy.force 'com.google.code.findbugs:jsr305:1.3.9' } } dependencies { compile fileTree(include: ['*.jar'], dir: 'libs') androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { exclude group: 'com.android.support', module: 'support-annotations' }) compile 'com.android.support:appcompat-v7:25.+' compile 'com.android.support.constraint:constraint-layout:1.0.2' testCompile 'junit:junit:4.12' //androidTestCompile 'com.android.support.test:runner:1.0.2' //androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2' compile 'org.ros.android_core:android_10:[0.3,0.4)' }