Skip to content
This repository was archived by the owner on Dec 16, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions android/tflite/WORKSPACE
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Android sdk and ndk
android_sdk_repository(name="androidsdk")
android_ndk_repository(name="androidndk")

# for maven_aar
load("@bazel_tools//tools/build_defs/repo:maven_rules.bzl", "maven_aar")

# https://jcenter.bintray.com/org/tensorflow/tensorflow-lite/0.1.7/tensorflow-lite-0.1.7.pom
maven_aar(
name = "tensorflow_lite",
artifact = "org.tensorflow:tensorflow-lite:0.1.7",
settings = "//app/src/main:jcenter.xml",
)


25 changes: 7 additions & 18 deletions android/tflite/app/src/main/BUILD
Original file line number Diff line number Diff line change
@@ -1,41 +1,30 @@
package(default_visibility = ["//visibility:private"])
package(default_visibility = ["//visibility:public"])

licenses(["notice"]) # Apache 2.0

android_binary(
name = "TfLiteCameraDemo",
name = "tflite",
srcs = glob(["java/**/*.java"]),
assets = [
"@tflite_mobilenet//:labels.txt",
"@tflite_mobilenet//:mobilenet_quant_v1_224.tflite",
"//app/src/main/assets:graph.lite",
"//app/src/main/assets:labels.txt",
],
assets_dir = "",
custom_package = "com.example.android.tflitecamerademo",
manifest = "AndroidManifest.xml",
nocompress_extensions = [
".tflite",
".lite",
],
resource_files = glob(["res/**"]),
# In some platforms we don't have an Android SDK/NDK and this target
# can't be built. We need to prevent the build system from trying to
# use the target in that case.
tags = ["manual"],
deps = [
"//tensorflow/contrib/lite/java:tensorflowlite",
"//tensorflow/contrib/lite/java/src/testhelper/java/org/tensorflow/lite:testhelper",
"@androidsdk//com.android.support:support-v13-25.2.0",
"@androidsdk//com.android.support:support-v4-25.2.0",
"@tensorflow_lite//aar",
],
)

filegroup(
name = "all_files",
srcs = glob(
["**/*"],
exclude = [
"**/METADATA",
"**/OWNERS",
],
),
visibility = ["//tensorflow:__subpackages__"],
)
exports_files(["jcenter.xml"])
21 changes: 21 additions & 0 deletions android/tflite/app/src/main/jcenter.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version='1.0' encoding='UTF-8'?>
<settings
xsi:schemaLocation='http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd'
xmlns='http://maven.apache.org/SETTINGS/1.0.0'
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
<profiles>
<profile>
<id>bintray</id>
<repositories>
<repository>
<id>central</id>
<name>bintray</name>
<url>http://jcenter.bintray.com</url>
</repository>
</repositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>bintray</activeProfile>
</activeProfiles>
</settings>
30 changes: 30 additions & 0 deletions android/tfmobile/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package(default_visibility = ["//visibility:public"])

licenses(["notice"]) # Apache 2.0

android_binary(
name = "tfmobile",
srcs = glob(["src/**/*.java"]),
assets = [
"//assets:graph.pb",
"//assets:labels.txt",
],
assets_dir = "",
custom_package = "org.tensorflow.demo",
manifest = "AndroidManifest.xml",
nocompress_extensions = [
".pb",
],
resource_files = glob(["res/**"]),
# In some platforms we don't have an Android SDK/NDK and this target
# can't be built. We need to prevent the build system from trying to
# use the target in that case.
tags = ["manual"],
deps = [
"@androidsdk//com.android.support:support-v13-25.2.0",
"@androidsdk//com.android.support:support-v4-25.2.0",
"@tensorflow_android//aar",
],
)

exports_files(["jcenter.xml"])
14 changes: 14 additions & 0 deletions android/tfmobile/WORKSPACE
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Android sdk and ndk
android_sdk_repository(name="androidsdk")
android_ndk_repository(name="androidndk")

# for maven_aar
load("@bazel_tools//tools/build_defs/repo:maven_rules.bzl", "maven_aar")

# https://jcenter.bintray.com/org/tensorflow/tensorflow-lite/0.1.7/tensorflow-lite-0.1.7.pom
maven_aar(
name = "tensorflow_android",
artifact = "org.tensorflow:tensorflow-android:1.8.0",
)


12 changes: 12 additions & 0 deletions android/tfmobile/assets/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package(default_visibility = ["//visibility:public"])

licenses(["notice"]) # Apache 2.0

exports_files(
glob(
["**/*"],
exclude = [
"BUILD",
],
),
)