DiegoAPP–整體架構介紹

1.開發環境

RobotCA是採用Eclipse進行開發,在DiegoAPP中將整個項目遷移到了Android Studio 3.4開發
在這裏插入圖片描述
Android Studio中Gradle 和Gradle Plugin的版本入下圖,Gradle和Gradle Plugin的版本非常重要,其他的版本會出現一些編譯錯誤。
在這裏插入圖片描述
Diego APP支持了Android8.0,Android8.1,Android9.0版本,適應現在主流的Android手機,其他版本的也可以下載最新的Android SDK進行編譯,但有由於Android升級過程中接口函數會有所變化,故可能會影響正常的運行,如閃退等異常。
在這裏插入圖片描述
2.項目架構
Diego APP的目錄組織結構符合Android Studio APP的項目組織規範
在這裏插入圖片描述
com.diegorobot.app是主要的程序目錄

Core:主要的控制邏輯代碼,包括Robot的控制,Map,導航等。
Dialogs:對話框的邏輯代碼,對應res中的對話框資源
Fragments:對應與res中視圖的控制代碼
Layers:針對需要渲染的層的邏輯代碼,現在只有針對激光雷達數據的渲染代碼
Views:對應res的視圖文件的控制代碼
ControlAPP:主要的控制Activity,APP在連接進入控制模式後,運行此Activity
RobotChooser:APP啓動時的Activity,用來配置連接信息,顯示Robot列表
ToolbarActionItemTarget:Robot列表中的工具條對應的類

2.Build.gradle
App的編譯配置文件中定義了App支持的版本,依賴的包等信息,特別是編譯時所涉及到包,一定要正確,否則會出現編譯異常, build.gradle代碼如下

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    buildToolsVersion '28.0.3'
    defaultConfig {
        applicationId "com.diegorobot.app"
        minSdkVersion 26
        targetSdkVersion 28
        multiDexEnabled true
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
     buildTypes {
         release {
             minifyEnabled false
             proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
         }
     }
    lintOptions {
        checkReleaseBuilds false
        // Or, if you prefer, you can continue to check for errors in release builds,
        // but continue the build even when errors are found:
        abortOnError false
    }
    dexOptions {
        javaMaxHeapSize "4g"
    }
}


configurations {
    all*.exclude group: 'org.ros.rosjava_bootstrap', module: 'gradle_plugins'
}
repositories {
    mavenLocal()
    mavenCentral()
    maven {
        url "https://github.com/rosjava/rosjava_mvn_repo/raw/master"
    }
    //maven { url "https://jitpack.io" }

}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support:support-v4:28.0.0'
    implementation 'com.android.support:design:28.0.0'
    implementation 'com.android.support:cardview-v7:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'com.android.support:recyclerview-v7:28.0.0'
    implementation 'org.ros.android_core:android_core_components:0.4.0'
    implementation 'com.github.rosjava.android_extras:gingerbread:[0.3,0.4)'
    implementation 'org.ros.rosjava_messages:tf2_msgs:[0.5,0.6)'
    implementation 'com.google.code.gson:gson:2.8.5'
    implementation 'org.apache.commons:commons-lang3:3.9'
    implementation 'com.squareup.okhttp:okhttp:2.7.5'
    implementation 'com.github.amlcurran.showcaseview:library:5.4.3'
    //testCompile 'junit:junit:4.12'
}



dependencies {
    // Required -- JUnit 4 framework
    testImplementation 'junit:junit:4.12'
    // Optional -- Mockito framework
    testImplementation 'org.mockito:mockito-core:2.27.0'

    androidTestImplementation 'com.android.support:support-annotations:28.0.0'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test:rules:1.0.2'
    // Optional -- Hamcrest library
    androidTestImplementation 'org.hamcrest:hamcrest-library:2.1'
    // Optional -- UI testing with Espresso
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    // Optional -- UI testing with UI Automator
//    androidTestCompile 'com.android.support.test.uiautomator:uiautomator-v15'
}


configurations.all {
    resolutionStrategy.force 'com.google.code.findbugs:jsr305:1.3.9'
    resolutionStrategy.force 'junit:junit:4.12'
}
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章