GCM server using app engine for java not working - android

So i have followed the GCM Demo application tutorial. http://developer.android.com/guide/google/gcm/demo.html
I got it working with jetty server.
But now i would like to do the app engine for java server and it is not working.
I am sure that my client is configured oke, because it was working for jetty server.
In ApiKeyInitializer.java i replaced "replace_this_text_by_your_Simple_API_Access_key" with my access key.
I copied the appengine sdk to a simple location D:\appenginesdk
Than i run in cmd:
ant -Dsdk.dir=D:\appenginesdk runserver -Dserver.host=192.168.0.101
Where 192.168.0.101 is my local ip.
D:\gmcserverapp>ant -Dsdk.dir=D:\appenginesdk runserver -Dserver.host=192.168.0.101
Buildfile: D:\gmcserverapp\build.xml
init:
copyjars:
compile:
[javac] Compiling 1 source file to D:\gmcserverapp\WebContent\WEB-INF\classes
[javac]
[javac] WARNING
[javac]
[javac] The -source switch defaults to 1.7 in JDK 1.7.
[javac] If you specify -target 1.5 you now must also specify -source 1.5.
[javac] Ant will implicitly add -source 1.5 for you. Please change your build file.
[javac] warning: [options] bootstrap class path not set in conjunction with-source 1.5
[javac] 1 warning
datanucleusenhance:
[enhance] DataNucleus Enhancer (version 1.1.4) : Enhancement of classes
[enhance] DataNucleus Enhancer completed with success for 0 classes. Timings :input=156 ms, enhance=0 ms, total=156 ms. Consult the log for full details
[enhance] DataNucleus Enhancer completed and no classes were enhanced. Consult the log for full details
runserver:
[java] aug 21, 2012 1:17:55 PM com.google.apphosting.utils.jetty.JettyLogger info
[java] INFO: Logging to JettyLogger(null) via com.google.apphosting.utils.jetty.JettyLogger
[java] aug 21, 2012 1:17:55 PM com.google.apphosting.utils.config.AppEngineWebXmlReader readAppEngineWebXml
[java] INFO: Successfully processed D:\gmcserverapp\WebContent\WEB-INF/appengine-web.xml
[java] aug 21, 2012 1:17:55 PM com.google.apphosting.utils.config.AbstractConfigXmlReader readConfigXml
[java] INFO: Successfully processed D:\gmcserverapp\WebContent\WEB-INF/web.xml
[java] aug 21, 2012 3:17:57 PM com.google.appengine.tools.development.DevAppServerImpl start
[java] INFO: The server is running at http://192.168.0.101:8080/
[java] aug 21, 2012 3:17:57 PM com.google.appengine.tools.development.DevAppServerImpl start
[java] INFO: The admin console is running at http://192.168.0.101:8080/_ah/admin
This is what i get in the emulator
And in the browser i get no device registered.
What can i do?
What am i doing wrong?
I did a lot of tutorials, nothing worked, i am becoming desperate.
EDIT 2012-08-21 15:57:
Thanks Yahor10, that solved some errors.
I now get this error:
[java] aug 21, 2012 1:52:40 PM com.google.appengine.tools.development.LocalResourceFileServlet doGet
[java] WARNING: No file found for: //register
EDIT 2012-08-21 16:18:
// String serverUrl = SERVER_URL + "/register";
String serverUrl = SERVER_URL;
I changed the server_url in serverUtilities.java for the android app. This made the emulator say that it is connected. But when i refresh 192.168.0.101:8080 it still gives No devices.....

I had been having similar difficulties with the GCM demo until I figured out that the server_url I had was incorrect. I had set it to 'http://< my_ip_address>:8080/gcm-demo' as the example and tutorial suggest. And whats more, ant was giving me a log for everytime the app tried to contact the server, so I didn't think the url was incorrect.
But I just took out the '/gcm-demo' from the end of the url and it works like a charm.
Hope this was/is what was giving you a headache.
-Mrdresden

Set 1.7 java code in your server build.xml
<target name="compile" depends="init" description="Compile the Java classes.">
<javac destdir="${classes}" debug="true" srcdir="${src}" target="1.7"
includeantruntime="false">
<classpath refid="compile.classpath"/>
</javac>
</target>
Set correct dir location of App engine sdk and
write correct ip address of your computer on the client side

Related

Android Kernel Configs

I am a newbie in Android13 I have setup the AOSP by following steps-
repo init -u https://android.googlesource.com/platform/manifest -b android-13.0.0_r31
repo sync
source build/envsetup.sh
lunch aosp_cf_x86_auto-userdebug
emulator
But I am getting following errors:
> WARNING: encryption is off
> WARNING: lavapipe is not a conformant vulkan implementation, testing use only.
> WARNING: Ignoring invalid http proxy: Bad format: invalid port number (must be decimal)
> INFO: IniFile.cpp:177: Failed to process .ini file /home/dsx1pu/.android/emu-update-last-check.ini for reading.
> WARNING: UpdateCheck: Failure: Error
> WARNING: UpdateCheck: failed to get the latest version, skipping check (current version '30.3.0-6946397')
> WARNING: UpdateCheck: Failure: Error
> ^CSaving state on exit with session uptime 28291 ms
>
Note: I am working inside Virtual Box.
My requirement is I want to explore the automotive OS and to somehow build from source code and emulate any one of the product on my x86 laptop.
So I can experiment with the AOSP and see the effect on my emulated automotive device what are different approaches.
I was thinking if I can work inside qemu. Please suggest.
Also I see following options, what are these and how they differ:
aosp_car_x86_64-userdebug
car_x86_64-userdebug
what is the difference between the two?
Please excuse me if something is irrevalant in the question.
Please guide.. considering me as a beginner.
Also suggest any article or put some light on android build process.
Any knowledge shared or experience is highly appreciated.
Also to end I will be really thannkful if someone can suggest some forums and community to follow to acquire the knowledge of Android Automotive OS.
Thanks!

Android aapt2 tool fails with "failed to open file: The device does not recognize the command"?

as part of a custom Android build chain, I am calling "aapt2 link" in order to link the files generated by a previous call to "aapt2 compile" together. This works fine on Mac, but on Windows it fails with the following error:
failed to open file: The device does not recognize the command.
I'm using the same SDK versions, and the error happens on multiple systems, including my own those of users of our build chain.
I'm calling rapt as follows:
C:\Users\mh\AppData\Local\Android\sdk\build-tools\33.0.1\aapt2.exe
link
-v
-o c:\obj\destination.apk
--manifest c:\Obj\manifest.xml
--java c:\Obj\java
-I C:\obj\android.jar
--proto-format
--min-sdk-version 26
--target-sdk-version 26
#c:\Obj\Aapt2LinkFiles.txt
(paths shortened for clarity here). All files listed in c:\Obj\Aapt2LinkFiles.txt exist, and aapt prints them all out, before emitting the error.
Does anyone have an idea what I could be missing?
As a side question: Is there a way to see, in Android Studio, how and with what parameters aapt2 is called as part of the normal automated build process? Because builds in Android Studio work fine (but I seem to not be able tom find any lace where there is a full build log, in the way that other IDEs such as Xcode or Visual Studio provide a textual overview of what actual tools get executed and with what parameters, as you build.
Thanx!
Update full command line for repro:
C:> C:\Users\mh\AppData\Local\Android\sdk\build-tools\33.0.1\aapt2.exe link -v -o c:\Obj\ForAAB.apk --manifest c:\Obj\m.xml --java c:\Obj\java -I C:\obj\a.jar --proto-format --min-sdk-version 26 --target-sdk-version 26 #c:\Obj\files.txt
Output
note: including C:\obj\a.jar.
note: linking package 'org.me.testapt2' using package ID 7f.
c:\Obj\res-aapt2\drawable-hdpi_icon.png.flat
c:\Obj\res-aapt2\drawable-ldpi_icon.png.flat
c:\Obj\res-aapt2\drawable-mdpi_icon.png.flat
c:\Obj\res-aapt2\drawable-xhdpi_icon.png.flat
c:\Obj\res-aapt2\drawable_icon.png.flat
c:\Obj\res-aapt2\layout_main.xml.flat: error: failed to open file: The device does not recognize the command. (22).
error: failed parsing input.
files can be found at https://www.dropbox.com/s/zuuopmhyzkd271u/Obj.zip?dl=0, unzip to C:\Obj

Unable to compile Android app - Error 256 in Corona

I am using Corona SDK and I am trying to compile my app for Android. I have been able to compile for iOS.
When compiling using either a fully signed distribution key or a debug key I am given the following error:
Build Failed: Error code: 256
The full error is as follows:
Sep 23 01:24:00.635 Building Android app for mgr****#**.com with 2017.3135
Sep 23 01:24:02.541 BUILD SUCCESSFUL
Total time: 0 seconds
Sep 23 01:24:02.542
Sep 23 01:25:24.905 BuildID: 59c5a9a30bb42
Sep 23 01:25:34.119 [exec] Result: 1
Sep 23 01:25:36.428 BUILD FAILED
/Applications/Corona/Corona Simulator.app/Contents/Resources/build.xml:479: The following error occurred while executing this line:
/Applications/Corona/Corona Simulator.app/Contents/Resources/build.xml:454: jarsigner returned: 1
Total time: 6 seconds
Sep 23 01:25:36.539 Android build failed (256) after 95 seconds
Sep 23 01:25:36.816 ERROR: Build Failed: Error code: 256
I have tried Google Play and Amazon targets with the same outcome.
Any ideas massively appreciated.
I was able to compile the exact same files on a different machine (Windows) without an issue. I guess this is down to the Java installation on the other machine.
Interestingly, Corona required the 32-bit version of Java on Windows, which meant downloading a slightly older SDK/JDK (latest SDK only has 64-bit builds). My Mac has the latest 64-bit build, which Corona does not complain about, but isn't able to build with.

Cannot compile bazel needed for tensorflow-android

I'm trying to explore the tensorflow android demo. I want to adapt the app using android studio.
However when I simply follow the instructions I get compilation errors no matter what I do:
Trying to compile tensorflow using bazel and NDK r12b:
$bazel build -c opt //tensorflow/examples/android:tensorflow_demo
ERROR: /home/myUser/libs/tensorflow_android/WORKSPACE:3:1: //external:io_bazel_rules_closure: no such attribute 'urls' in 'http_archive' rule.
ERROR: /home/myUser/libs/tensorflow_android/WORKSPACE:3:1: //external:io_bazel_rules_closure: missing value for mandatory attribute 'url' in 'http_archive' rule.
ERROR: com.google.devtools.build.lib.packages.BuildFileContainsErrorsException: error loading package '': Encountered error while reading extension file 'closure/defs.bzl': no such package '#io_bazel_rules_closure//closure': error loading package 'external': Could not load //external package.
INFO: Elapsed time: 0.129s
Trying to compile a newer version of bazel following this advice:
$bazel version
Build label: 0.2.3-jdk7 // This is my current version of bazel
via apt-get:
$sudo apt-get upgrade bazel
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
E: Unable to locate package bazel
from source (tried bazel-0.4.2 and bazel-0.5.0):
$./compile.sh
INFO: You can skip this first step by providing a path to the bazel binary as second argument:
INFO: ./compile.sh compile /path/to/bazel
🍃 Building Bazel from scratch
ERROR: JDK version (1.7) is lower than 1.8, please set $JAVA_HOME.
or
$bazel build //src:bazel
ERROR: /home/myUser/libs/bazel/bazel-0.4.2/tools/build_rules/genproto.bzl:45:16: Traceback (most recent call last):
File "/home/myUser/libs/bazel/bazel-0.4.2/tools/build_rules/genproto.bzl", line 42
rule(gensrcjar_impl, attrs = {"src": at..."), <2 more arguments>), "_proto_compiler": attr.label(default = Label("//third_party/p..."), <4 more arguments>), "_jar": attr.label(default = Label("#bazel_tools//t..."), <4 more arguments>), "_jdk": attr.label(default = Label("#bazel_tools//t..."), ...)}, ..."})
File "/home/myUser/libs/bazel/bazel-0.4.2/tools/build_rules/genproto.bzl", line 45, in rule
attr.label(allow_files = proto_filetype, sing...)
allow_files should be a boolean or a filetype object.
ERROR: /home/myUser/libs/bazel/bazel-0.4.2/src/BUILD:130:1: error loading package 'src/main/protobuf': Extension file 'tools/build_rules/genproto.bzl' has errors and referenced by '//src:embedded_tools'.
ERROR: Loading failed; build aborted.
INFO: Elapsed time: 0.251s
switching aroung java-versions to see whether the bazel compiling issues come from there:
$sudo update-alternatives --config java
There are 4 choices for the alternative java (providing /usr/bin/java).
Selection Path Priority Status
------------------------------------------------------------
0 /usr/lib/jvm/java-8-oracle/jre/bin/java 1074 auto mode
1 /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java 1071 manual mode
* 2 /usr/lib/jvm/java-7-oracle/jre/bin/java 1072 manual mode
3 /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java 1069 manual mode
4 /usr/lib/jvm/java-8-oracle/jre/bin/java 1074 manual mode
No luck so far :-/. Has anyone successfully compiled tensorflow for android from source?
What version of Tensorflow, NDK, bazel, java are required / compatible with each other? Do I really need bazel? (never worked with it anyway) Can't I just compile the android demo in android-studio like any other app?
I'm using Ubuntu 14.04, Cuda8.0, cudnn_v5.1, Titan X Pascal (not sure if these things matter)
Installing Bazel on Ubuntu can be done without compiling.
Follow all steps of the dedicated documentation: Install Bazel on Ubuntu

Python System Call Cannot Find File, Error Running on Apache Server

I'm trying to run an os.system() call from my Python class to source a file I have stored in the file. I am connecting to a server from an Android application and running a method in Django to run a system call. The server is running Apache with mod_wsgi to deploy Django. This is the Django method:
def post_try(request):
os.chdir("/usr/local/src")
response = os.system("source sourceme")
return HttpResponse(response)
The code works fine as far as syntax goes, all necessary imports are done, however I keep getting a 256 error code back instead of the expected 0. I check the error in the Apache log and this is what I get:
[Sun Aug 18 19:43:23 2013] [notice] caught SIGTERM, shutting down
[Sun Aug 18 19:43:24 2013] [warn] mod_wsgi: Compiled for Python/2.7.2+.
[Sun Aug 18 19:43:24 2013] [warn] mod_wsgi: Runtime using Python/2.7.3.
[Sun Aug 18 19:43:24 2013] [notice] Apache/2.2.22 (Ubuntu) mod_wsgi/3.3 Python/2.7.3 configured -- resuming normal operations
[Sun Aug 18 19:46:04 2013] [notice] caught SIGTERM, shutting down
[Sun Aug 18 19:46:05 2013] [warn] mod_wsgi: Compiled for Python/2.7.2+.
[Sun Aug 18 19:46:05 2013] [warn] mod_wsgi: Runtime using Python/2.7.3.
[Sun Aug 18 19:46:05 2013] [notice] Apache/2.2.22 (Ubuntu) mod_wsgi/3.3 Python/2.7.3 configured -- resuming normal operations
sh: line 0: source: sourceme: file not found
I cannot figure out what is going on. I have the sourceme file clearly in the /usr/locals/src/ folder, which I have verified many times using ls. I do not know what is happening. I used os.getcwd() to check that the directory is being changed correctly, but the file still cannot be found. Please let me know if there is anything that I am missing, as I am very frustrated at this problem that I can just not realize.
Thank you
Your approach currently does not make sense:
os.system creates a child process of the WSGI process, while the environment of the parent is passed on to the child, the environment of the child is not passed back/shared with the parent.
Also, source is not a binary, but a built-in function of the shell itself.
If you want to set environment variables us os.environ which is a dictionary of the variables.
Since you are using python, it would be much more sensible to use python program instead of some os.system calls. That is, create python program with the environment variables, add it to your PYTHONPATH and import it in your django code.

Categories

Resources