ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

After a lots of check in many ways, finally I think it's maybe the bad network caused the problem. And at last, I had made a configuration for the build.gradle files, and seems good. Anyway, my demo finally works. Here is the settings of the files:

buildscript {
    apply from: "https://github.com/rosjava/android_core/raw/kinetic/buildscript.gradle"
}

allprojects {
    repositories {
        jcenter()
    }
}

subprojects {
    apply plugin: 'ros-android'

    afterEvaluate { project ->
        android {
            packagingOptions {
                exclude 'META-INF/LICENSE.txt'
                exclude 'META-INF/NOTICE.txt'
            }
        }
    }
}

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

in app directory:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.2"

    defaultConfig {
        applicationId "com.ros.rosAndroidTest"
        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'
        }
    }

    configurations.all {
        resolutionStrategy.force 'com.google.code.findbugs:jsr305:3.0.1'
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])

    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })

    compile 'com.android.support.constraint:constraint-layout:1.0.2'

    //ros dependencies
    compile 'org.ros.rosjava_core:rosjava_tutorial_pubsub:[0.2,0.3)'
    compile('org.ros.android_core:android_10:[0.3, 0.4)') {
        exclude group: 'junit'
        exclude group: 'xml-apis'
    }

    testCompile 'junit:junit:4.12'
}

Hope this could be a good suggestion for beginners like me!