Skip to content
This repository was archived by the owner on Nov 9, 2022. It is now read-only.
This repository was archived by the owner on Nov 9, 2022. It is now read-only.

class file for org.ros.internal.message.Message not found #311

Open

Description

@angie-liao

Hi all,

I tried to do this:

@Override
public void onStart(final ConnectedNode connectedNode){
    final Publisher<std_msgs.String> pubString =
            connectedNode.newPublisher("table_talk", std_msgs.String._TYPE);

    connectedNode.executeCancellableLoop(new CancellableLoop() {
        @Override
        protected void loop() throws InterruptedException {
            std_msgs.String msg = pubString.newMessage();
            msg.setData("hello");
            pubString.publish(msg);
            Thread.sleep(1000);
        }
    });
}

then I got the error message:

error: cannot access Message
 msg.setData("Hello");
                   ^
  class file for org.ros.internal.message.Message not found

And this is my build.gradle:

buildscript {
    repositories {
        google()
        jcenter()
        maven { url 'https://github.com/rosjava/rosjava_mvn_repo/raw/master' }
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.5.3'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()

        maven { url 'https://github.com/rosjava/rosjava_mvn_repo/raw/master' }
        mavenCentral()

    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

another one:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 29
    buildToolsVersion "29.0.2"
    defaultConfig {
        applicationId "test.android"
        minSdkVersion 15
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test.ext:junit:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'

    implementation 'org.ros.rosjava_core:rosjava:[0.1,0.2)'
    implementation 'org.ros.android_core:android_10:[0.3,0.4)'
    implementation 'org.ros.android_core:android_15:[0.3,0.4)'
    implementation 'org.ros.rosjava_messages:std_msgs:[0.5, 0.6)'
}

May somebody help me? Thank you!!

Activity

  1. colin-broderick commented on Jan 24, 2020

    @colin-broderick

    Same problem. I'm working from what looks like the same example as SyuanLiao: https://github.com/ollide/rosjava_android_template/tree/master/rosandroid-example-app/src/main/java/org/ollide/rosandroid

    apply plugin: 'com.android.application'
    
    android {
        compileSdkVersion 29
        buildToolsVersion "29.0.2"
        defaultConfig {
            applicationId "com.example.rosdroid"
            minSdkVersion 15
            targetSdkVersion 29
            versionCode 1
            versionName "1.0"
            testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        }
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
            }
        }
    }
    
    dependencies {
        implementation fileTree(dir: 'libs', include: ['*.jar'])
        implementation 'androidx.appcompat:appcompat:1.1.0'
        implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
        implementation 'com.google.android.material:material:1.0.0'
        testImplementation 'junit:junit:4.12'
        androidTestImplementation 'androidx.test.ext:junit:1.1.1'
        androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
    
        implementation 'org.ros.android_core:android_honeycomb_mr2:0.1.2'
        implementation 'org.ros.android_core:android_gingerbread_mr1:0.1.2'
        implementation 'org.ros.rosjava_core:rosjava:0.3.6'
        implementation 'org.ros.rosjava_messages:std_msgs:0.5.11'
    }
    
    
  2. Goochaozheng commented on Apr 7, 2021

    @Goochaozheng

    Solved the same problem according to this.
    Adding message related dependencies manually to your build.gradle file:

    implementation 'org.ros.rosjava_bootstrap:message_generation:[0.3, 0.4)'
    

    It looks like newer version of gradle fails to resolve these second-level dependencies properly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions