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

时间:2023-03-09 09:42:47
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
buildToolsVersion '26.0.2' if (nativeBuildSystem == 'cmake') {

修改(buildToolsVersion版本视自己当前安装决定):

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

编译完之后只会生成一个apk文件,但安装的时候会生成4个APP。