Creating simple Android app using android studio and tensorflow - android

Update 1
I have installed the official WIN package located at PyPi repository
Just to make sure I did not miss anything, I downloaded the .whl file manually, renamed it to .zip, opened and listed all the files and directories inside this package. There is nothing related to android.
Following this question, there is now a support of TensorFlow for Windows. I installed it using the instructions provided as part of Anaconda, and it works.
However, I can't seem to find information about developing an application with TensorFlow for Android in Windows, by using Android Studio.
Currently I tried:
Downloaded the Android example from the main branch (which is for Linux), opened it in Android Studio. The following line doesn't work: import org.tensorflow.contrib.android.TensorFlowInferenceInterface;. I can't guess where to import the libraries. I've tried to read the documentation in readme.md, but it looks very Linux oriented, .sh scripts and etc.
Found the path of TensorFlow installation in Windows,
C:\Program Files\Miniconda2\envs\py35\Lib\site-packages\tensorflow\contrib\android\java, but it is completely empty.
Any idea?

My guess is the Android example, originally targeted for Linux, has not been updated to work on Windows. The TensorFlow update that supports Windows was just released last week.

Related

Why don't we have a single file to open an Android Studio Project?

Why don't we have a file similar to the .xcodeproj (for XCode applications) or an .xds (for Sencha Architect Projects) for our Android Studio Project?
I'm pretty sure a good number of you here have experienced the frustration of trying to import a project you see online in order to piece it apart better and learn how it works. I get that we are supposed to Import Android Projects built using Eclipse and Open Android Projects built using Android Studio.
However, why is it that we have to go through File -> Open -> then pick out the directory of the Android Studio app that we want to open? And the thing is, Android Studio doesn't seem to know it's an Android Studio project until it tries to open and build it. In the screenshot I have below, I have the sample Android Studio projects of ARToolKit, but I've only imported two of them.
As you can see, only those I've imported "can be seen as an Android Studio Project" as indicated that they have the Android Studio logo instead of a Folder.
This can be an issue for those just starting to develop in Android Studio on their own and they try and use existing projects (build from Eclipse or Android Studio) and they hit a snag with just trying to import the projects for reference. They might not know that they should import the folder and not the projectname/src subfolder. It adds to the "steep learning curve" that Android Development has if opening/importing projects aren't streamlined to a degree.
To sum up, my question is:
Why don't we have a single file that we can open that would in turn open Android Studio and import and build the project if it isn't built yet?
Android is not iOS. iOS development is only possible in xcode, hence it makes sense they added a shortcut to open it in xcode directly with a .xcodeproj file. Make life easier for iOS developers.
Android development however can be done outside of android studio as well. Eclipse is just one example, there may be other IDE's that support this. This is possible because android has standalone SDKs and tools that third party applications can use. iOS does not.
Imagine you are working on an android project in android studio. Then your boss tells you someone from 3000km away is going to help you. This guy may be using android studio, but maybe he isn't. When there are multiple options that developers can choose from individually, you do not want to pollute version control with files that you are using, but others may not care about. Each their environment.
This is merely a logical conclusion that you can come to by comparing. The "real" reason why this was done can only be answered by the people that created (adapted intellij) android studio.
This has been very frustrating to me too.
I try to give you a "beta" answer, waiting somebody to confirm it to me.
An Android project is just the composition of many parts that in some cases are concurrent to create the apk file.
It's just like what happens for the whole java projects: you have the main/src/java, the main/src/test, the maver or gradle files, the gradle or maven wrapper, the manifest, the configuration etc.
So you won't have a single project, but a series of folders that can contain many "flavours" or "versions" of the product itself.
The only help it is given to us is the Android studio icon that appears if a folder contains an android project in its subfolders.
I don't know if I have really answered to you, I just have given you my impressions and my thought.

TensorFlow Android demo: unable to build with Bazel, could not read RELEASE.TXT

Recently I've been learning how to use TensorFlow, and wanted to set up the Android demos on my computer to see how they worked. I followed the instructions provided here, with the only differences being that I installed the Android SDK through Android Studio, and installed the Android NDK through the SDK Manager. Up until $ bazel build //tensorflow/examples/android:tensorflow_demo, everything worked fine, but after that, I got this error from the terminal:
ERROR: no such package '#androidndk//': Could not read RELEASE.TXT in Android NDK: /home/me/.cache/bazel/_bazel_me/f3471be34d1e62bf21975aa777cedaa3/external/androidndk/ndk/RELEASE.TXT (No such file or directory).
ERROR: no such package '#androidndk//': Could not read RELEASE.TXT in Android NDK: /home/me/.cache/bazel/_bazel_me/f3471be34d1e62bf21975aa777cedaa3/external/androidndk/ndk/RELEASE.TXT (No such file or directory).
From looking around at similar issues, my understanding is that this error is because the RELEASE.TXT file isn't included in the most recent version of Android NDK. This issue suggested downgrading to a previous version of NDK which contains a RELEASE.TXT file, and provided links to download such versions. However, the link that I followed (https://dl.google.com/android/ndk/android-ndk-r10e-linux-x86_64.bin) downloaded a .bin file, which is unusable to me. That post also suggested commenting out the NDK entry in the WORKSPACE file, but I haven't tried that yet, since I don't know if it will cause further complications down the road.
Another approach that I've tried is going to the path indicated by the error log (/home/me/.cache/bazel/_bazel_me/f3471be34d1e62bf21975aa777cedaa3/external/androidndk/ndk) and creating a blank RELEASE.TXT file, which made no difference. (I wasn't able to create one in the NDK that I installed, since it was in the form of a .jar file at the path /home/me/android-studio/android-studio/plugins/android-ndk/lib, thus the only way I could see was this path.)
As it stands, I'm at a dead end. Is there another way to resolve this issue without downgrading or commenting out the NDK entry? If not, how can I install a previous version of Android NDK?
I also posted this as issue #3175 in the official GitHub repository for TensorFlow, and it's been resolved. A play-by-play of the steps I followed to solve the problem can be found in that thread. It's a bit convoluted, so the steps I believe will solve an issue like this are as follows:
If you didn't use the --recursive option when git cloning the TensorFlow repository, re-clone it using that.
Downgrade to Android NDK r11c (and make sure to update the WORKSPACE file accordingly). A link for the Linux version can be found in the GitHub thread.
Check the version of your Android SDK and build tools. If they differ from the default versions written in the WORKSPACE file, make sure to change that.
You may run into a TensorFlow issue that is, as of yet, unresolved. (#3374) If so, run ./configure as a workaround.
And that should allow the Bazel build to proceed successfully.
Have you looked at using an alternative way to compile TensorFlow for Android without using Bazel? It's described in TensorFlow Makefile

What to do after google's instructions to building ADT?

I download the android source, changed the framework layer such that I added new methods to it.
I compiled the code ( using make command ), and compiled the sdk using: make sdk.
After that I followed google's instructions here here
and successfully build the zip file containing the eclipse plugins. I am lost know and dont know how to exactly continue.
My final goal is to create an android application which uses the new methods I added to the sdk.
I'm no expert in modifying the Android source itself, but if you're hoping to create an app that uses methods that you've added to the SDK, then at the very least beyond compiling the SDK and Eclipse plugins, you're going to have to:
Actually install the Eclipse plugins in Eclipse
Create a ROM for your device that uses your version of the SDK
Actually install that ROM on your device
Write and install your app

Stella SDK to convert IOS App to Android

I installed Stella SDK and tried to convert a demo iOS app GLSprite to android. Followed the steps, but it seems the big problem with the instructions is that everything is installed in the /opt folder on mac and that folder seems to be protected on my computer, so all the commands I have to use sudo which confuses everything.
Then when I use Xcode to open the GLSprite project, xcode has problems because of the permissions because the project is rooted in /opt on the mac.
So I moved the project to my home folder, then I get errors saying missing include files like GL.H
I followed the steps I found on this site (someone else asked the same question) but that didnt help, still cant find GL.H nd some other includes.
I was going to use apportable, but it seems they dont have UIKit implemented yet which my app uses a lot.
Has anyone used Stella SDK to convert iOS app to Android?
To answer your original question - Stella requires using sudo and installing at /opt. Its tools depend upon hard coded paths.
The current Apportable UIKit implementation is already more complete than the one in Stella SDK.
A pre-release of a more complete Apportable UIKit implementation was made available yesterday. See this Ian Fischer's post in this Apportable discuss thread for details.

IntelliJ 12 Android Setup? Nothing works

IntelliJ 12 does not generate the needed files to start Android Development.
I've setup both JDK and SDK and intelliJ seems to see the correct paths.
I am coming from Eclipse which generates everything you need to start pretty much out of the box.
I've tried...
Double triple checking file paths.
Searching...alot of searching.
Making new files from scratch.
Making hello world program, still doesn't generate needed res folder and AndroidManifest.xml file.
Changing file path directly to AndroidManifest.xml's containing folder.
The one thing Eclipse provides that is missing from IntelliJ is and Android SDK install wizard. In other words, you would have to preinstall hte Android SDK from Google prior to starting with IntelliJ. Other than that IntelliJ actually provides more out of the box than Eclipse. (Especially considering you have to manually install the Android plugin before you get the Android SDK install wizard.) Go to the Google Android developer site to find the Android SDK and once you've done that you should be able to get up and running pretty quickly with IntelliJ. Start a new project and select Android. This should walk you through a new project wizard which will setup the necessary res and gen folders for you.
I've put together a screencast on Android development using an Eclipse stub project here: http://bit.ly/Zu6q8i

Categories

Resources