1. 程式人生 > >Ubuntu18.04使用AndroidStudio3.2.1編譯TensorFlow android demo【2018年12月】

Ubuntu18.04使用AndroidStudio3.2.1編譯TensorFlow android demo【2018年12月】

按照官方教程修改下面3處即可編譯完成。

修改部分:

在build.gradle檔案裡修改以下部分:

1、原來:

buildscript {
    repositories {
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'
        classpath 'org.apache.httpcomponents:httpclient:4.5.4'
    }
}

修改後:

buildscript {
    repositories {
        jcenter()
        maven {
            url 
'https://maven.google.com' } } dependencies { classpath 'com.android.tools.build:gradle:3.0.1' classpath 'org.apache.httpcomponents:httpclient:4.5.4' } }

2、原來:

def nativeBuildSystem = 'bazel'

修改後:

def nativeBuildSystem = 'none'

3、原來:

android {
    compileSdkVersion 
23 buildToolsVersion '26.0.2' if (nativeBuildSystem == 'cmake') {

修改:

android {
    compileSdkVersion 23
    buildToolsVersion '28.0.3'

    if (nativeBuildSystem == 'cmake') {

編譯完之後只會生成一個apk檔案,但安裝的時候會生成4個APP。