Adding GCM to android eclipse project - java

I am trying to add push notifications to my android application and I found this tutorial on the topic.
But eclipse does not recognize GoogleCoundMessaging, even though I added google_play_service_lib to my project.
Here is my captured screen

I have fixed my problem.
*I added "google_play service.jar" to my project "libs" folder and add it to project build path.
*Then eclipse recognized "GoogleCloudMessaging"
*But application stop working when try to get GCM RegID.
*I run my application without debugging. All problems fixed!

Related

Android studio design editor is unavailable until after a successful project sync

what is the actual root cause of this issue? I already sync with gradle files but eventually failed.
Just sync your project with gradles. File --> Sync Project with Gradle Files
Build -> Clean Project
Build -> Rebuild Project
File -> Sync project with gradle files . If not worked then try
File -> Invalidate Caches / Restart .
It's work for me !!!
That could be fixed in one or two steps, depending on how nice is Android Studio today:
Try to sync your project with gradle files:
If that doesn't work, invalidate Android Studio caches and restart. That should fix the problem:
The reason behind the first solution not working could be related on gradle cached dependencies problems, but who knows 🤷
This error mostly occurs when you're trying to open Android App from existing application and probably developed using different computer.
Almost all the troubleshoot methods like File->Sync Project, Build->Clean, etc. Might not work.
This is applied only if you are trying to open the Adroid Application from existing application.
The proper way to evoid errors is only to open sub folder from the path not the root folder. Below is the example of how to properly open the Android application from existing application.
For example in your Message_App/messages/msg path, you must open msg folder not your Message_App folder.
Message_App/messages/msg
>msg
>manifests
>java
>res
Just you have to do >> open File --> Sync Project with Gradle Files
and then after >> open File --> invalidate Android Studio caches / restart so done this problem.:)
sometimes Sync project with gradle File dosent work; you should check the compileSdkVersion in the "build.gradle" file , make them is the same number within all library/modlue
This issue is because the gradle file is not found when starting the project. To fix this ensure your connection to the internet is stable during project startup, the gradle file is downloaded automatically, after a successful download, You should be good!
Issue happened to me when I changed the res>values>styles.xml
What I change was
"Theme.AppCompat.Light.DarkActionBar" --->>> "Base.Theme.AppCompat.Light.DarkActionBar"
Solutions I tried.
Build -> Rebuild Project (Not worked)
Close all files and Open again. Then
Build -> Clean Project (Not worked)
File -> Sync project with gradle files (Not worked)
Close the Android Studio while project still opened. Opened it again. - It Worked.
If nothing of the above steps work, Then simply undo the changes that you have recently made, and then build gradle.
In my case, I have added one dependencies and this problem raised, so I removed that dependencies build the gradle and then again add it.
Problem Solved..!!
I had this problem and it was because I didn't have the right API level installed (and I was also getting an error to that effect). I went into Tools --> SDK Manager and installed the API the system was telling me I needed (in my case, 30). I did that and restarted Android Studio and was able to get into XML files.

After creating android project in Eclipse ADT, tons of errors show up

I'm using eclipse ADT (most recent version) to develop some android apps. I've followed the getting started tutorial at the dev.android.com and it worked just fine.
But when i tried to create another project with the same targets and sdk's, i've got nothing but errors:
Some errors and my sdk's:
That's the same sdk's i used before these errors started showing up.
What can be causing this?
EDIT: my project won't generate the R.java file
You might need to add a support library to your new project.
Check this link for downloading the support libraries -
http://developer.android.com/tools/support-library/setup.html#download
Please notice that you need to import them into your eclipse and then include one (preferably the newest, not sure about this) in your project.
EDIT:
Before downloading the support libraries you should first check if you have them already.
Try this, right click project folder in the eclipse package explorer, Properties>Android>Library>Add>select a library if you have one.
There might be an invalid library included in your project already, if that happens then you will see it in the Library>Add> menu, remove it and add a new one.
You might have clean your project ........
if yes.....you must check whether R.java file is present in **Project(your project)->gen->package name->R.java**
if not than u have to update Tool Folder in SDK manager

Trouble importing and running the Google Cardboard sample project

You can find the project here: https://github.com/googlesamples/cardboard
The last time I worked with android was about a year ago and I'm trying to use this VR project to get back into it. All I want to do is mess around with the app to get a feel for it.
However, I haven't been able to get it running. I installed a fresh copy of Eclipse (juno) with the JDK and android SDK and got the android 4.4W stuff from the SDK manager. I also made a Nexus 5 AVD.
My problem is that I've tried choosing multiple 'root' folders to 'import as existing android project' and none of them have been runnable. Each time the eclipse terminal gives an 'Installation error: Unknown failure' error after installing 'MainActivity.apk'.
I figured the 'main' folder would be most likely to work since it has the manifest and all the other folders associated with android projects.
How do I get it running?
#CommonsWare: I have the project up and running on Eclipse(Juno) with Android 4.4.2
#ThroatOfWinter: These steps should help you. They worked for me.
Download the project from github as a ZIP file
Extract the contents of the ZIP file (named cardboard-master) into a folder and then import the whole folder into Eclipse as a new android project
Create a new "libs" folder in your project
To use the Cardboard API, download the VR Toolkit .jar file and include it in your project in the "libs" folder.
If everything has worked fine so far, you'll find that the "src" folder in your new Cardboard project is empty but the "java" folder contains 3 .java files.
Create a new package in "src" called "com.google.vrtoolkit.cardboard.samples.treasurehunt"
Copy the 3 files from the "java" folder and paste in the package you created in the previous step.
Clean and build the project
Test on an android device (preferably) with the cardboard app installed
You shouldn't need to edit the manifest at all.
That is not an Eclipse project. It is for use with Android Studio and Gradle. Your choices are:
Switch to Android Studio, or
See if somebody else has already reorganized that code into an Eclipse project, or
Attempt to reorganize it yourself, moving the contents of src/main/ into appropriate locations and fixing up the manifest for things that are set now in build.gradle, or
Find something else as a project to get back into Android development
This alternative worked for me: https://github.com/raasun/treasurehunt
It's pretty much the same as the Cardboard sample project from Google except that it's compiled with Eclipse/ANT instead of Android Studio/gradle.
Just follow the first part of moyheen's instructions to set it up.
To make it work on Eclipse, I just placed the Cardboard API jar (cardboard.jar) at the root folder of my app (alongside AndroidManifest.xml), and then in Build Path dialog I just did "Add Jar" and selected cardboard.jar.
Warning: Placing cardboard.jar in libs/ folder won't work, I tried, and it will produce an invalid APK that can't be installed.

my eclipse install another app instead of mine in emulator

I'm having a problem with my eclipse i have edited my app and it's ready with no error shows but now when i run it into my emulator it runs another app i have in my eclipse so i deleted the app and still i run the application i want in the eclipse and still it shows the old app that i didn't even ask to install it in my emulator so it's installing an app that i don't have at first place in my eclipse i don't know how it is possible i cleaned my project and still the problem is there and changed my emulator still its install the old app for me
uninstall the app from the emulator and check in your run configuration about the running app and try with new emulator
Be sure you have selected in package explorer the app you want to run. Try to unistall the app from the emulator or create a new device on emulator. Hope this help.
Check the Run configuration: Run->Run configuration. Under the Android tab, choose your project. If you run in Debug, you have similar option too.
Another similar case I saw, is that some application was installed, but the name was not updated. Verify the names of your application in both the strings.xml and the Manifest. (If you create a project by duplicating another one, it might be the problem).

I'm unable to get WiEngine skeleton project to run

So I'm trying to port some cocos2d iOS apps over to Android and it looks like WiEngine is the most fully featured port of cocos2d to android ( http://www.wiyun.com/web/wiengine ), however I'm having issues getting the skeleton project to run. The latest problem I'm running into is I get a "Exception Ljava/lang/UnsatisfiedLinkError; thrown while initializing Lcom/wiyun/engine/skeleton/Skeleton" error in the ADB. I'm trying to run it in the emulator which also may be an issue. I'm kind of stuck because i need to see if I can get certain things to work (particle effects etc) before i can justify a hardware purchase.
Originally I tried to import the Skeleton project into eclipse but ran into too many errors so i created a blank android project with the same package name as the skeleton project and added the libraries to the build path through properties>libraries>add external Jars
the project compiles but it crashes as soon as it tries to initialize the Skeleton class here is the console stuff:
http://pastebin.com/XAc0XYiA
Appreciate any help on this.
Thanks,
Nick
You have to include JNI accessible precompiled libraries to you project. You can find them on the SDK archive.
For running your WiEngine Projects you have to add the WiEngine Library which is available when you download it from Github.
https://github.com/stubma/WiEngine
You can add library:
Right click on your Project-> Properties->Android->Library->Add WiEngine

Categories

Resources