IBM Worklight 6.1.0.0: Android environment missing some files - android

Steps:
Create a sample application "SampleApp" and add "android" environment to it.
Delete the "native" folder from the android environment. e.g. SampleApp/android/native
Right click on "android" folder and do - Run As -> Build Android Environment
Observe:
Following files are missing from the "native/libs" folder
android-async-http.jar
guava.jar
I didn't found any other way to include these files. On actual android device (Samsung Tab 3), "guava.jar" file is needed to initialize JSONStore object.

Update April 2nd, 2014: From the comments to this answer:
I have upgraded to Worklight 6.1.0.1. Now the issue is reproducible in
following scenario - 1. Instead of "native" folder, just delete these
2 files (android-async-http.jar, guava.jar) 2. rebuild the android
environment.
This is OK. The native folder is considered the user's domain. That means that if a user decides to remove parts of it - for example .jars from the lib\ folder, to maybe... reduce the app's filesize? that's okay. It is the user's responsibility.
I have tested this in Worklight 6.1.0.1; created a new project and application, added the Android environment, Run As > Run on Worklight Development Server.
The supposed missing files are in my android\native\libs folder:

Related

First step in cordova

I started with cordova and I have some small problems.
I've created an android application. I have installed java, android SDK , Apache Ant and Apache Ant.
I have added android with cordova add platforms android and builded correctly.
1 - When I use cordova run android I get the following error:
an error occured while running the android project . Buildfile : ...Demo \ platforms \ android \ build.xml . ERROR : Failed to install apk to device
I think this is due to the fact that my application is not in debug mode. How to set the debug mode? (' cordova emulate android ' works and launches the emulator )
2 - When I want to load a project in eclipse . (New project - > Android Project from Existing Code) I have the error:
Invalid project description Reason : . Invalid project description
How to overcome this error ?
3 - I want to install external plugins, eg
- https://github.com/ClickInnovate/CordovaPhoneGapPlugins/tree/master/Android/SocialMessage
- https://github.com/phonegap/phonegap-plugins/tree/master/Android/StatusBarNotification
It is said that to copy the java files in the src folder , but, I copy the java files in the original project or one that is build ( in plateform directorie )
If you run cordova run android -d, you will see additional debugging information printed to the console which should hopefully help you narrow down the problem. I've never seen that error you are getting, but to set your device up for debugging you should follow these steps. Some steps may be different or unneeded based on your Android device and version:
Settings --> Click on "About Tablet" --> Click on Build Number 7 times to activate "Developer mode"
Settings --> Developer options --> USB Debugging (make sure it is checked)
Settings -->Security-->Unknown Sources` (make sure it is checked)
Storage --> Click the drop down on the top right --> USB computer connection --> Make sure "Camera (PTP)" is checked
Please ensure that you are following the Android platform guide. If you are getting "Invalid project description" you might just need to type in a project description in one of the boxes in Eclipse? Another thing, make sure you are doing Import-->Android-->Android Project from Existing Code. Finally, it sounds like this might be a goofy Eclipse environment issue, here is another question on SO about this problem.
The plugins that you listed are old, they were made before Cordova 3.X came out. In 3.X, a new plugin management system using Cordova CLI and Plugman is used to install plugins - the only problem is that the plugins need to be updated to use this new format. You could look around to see if somebody has updated those plugins (look on the Fork page on GitHub is one good way.) Otherwise if you can't find an updated plugin, you could try to update the plugin yourself following the upgrade guides on the doc website. To answer your question, the java files would be need to eventually be copied into the build folder. In 3.X, the files are stored in the /plugins/ folder, then copied to the /platforms/android/ folder when you run cordova prepare, and are built into the cordova.jar when you do cordova compile. You can also read about how to install plugins with just plugman.

Phonegap How to make android build

I have created a build in ios successfully. Now i am trying to make build in android.
I have added android platform and imported this in eclise(ADT). I want to make configuration for android, as i am new to mobile application. I am unable to find any good reference for building android tutorial. I looked into getting started tutorial of phonegap but it was not much helpful
I assume you're using Cordova 3.0 and CLI
Proceed as following (some steps you might have already done, for completeness, I list them here anyway)
Open Eclipse ADT -> Window -> Android SDK Manager and make sure you have at least the 'Android SDK Tools', 'Android SDK Platform-tools' and at least on API installed.
Add the 'android sdk tools' and 'android sdk platform-tools' to your path.
In your cordova app (e.g. /myApp) folder, execute $cordova platform add android
Im assuming you have all your jscode correctly bundled in the /myApp/www folder, as you already have a working ios build. Otherwise, do so.
Plug in your Android Device or create and start a new AVD (In Eclipse: Window -> 'Android Virtual device manager').
execute $cordova prepare android
Open Eclipse and then File -> Import -> Android/Existing Code Into Workspace. In the opening 'Import Projects'-Window, select your /myApp/platforms/android as root directory. Depending on your workspace, you must select 'Copy projects into workspace', however your workspace would better already include the project, as this saves you from importing a new project after every $cordova prepare statement
In Eclipse: Run -> Run Configurations -> Target:: Enter Your settings depending on wether you use AVD or not.
On the bottom right: Run. Your app will be built and run.
Notes:
If you use mulitple platforms (e.g. android and ios), this way is more preferable than the way of user1306579, where you copy/hardlink your code directly in the /myApp/platforms/android/ folder, as you would have to do this for every platfrom equally and even worse: If you run $cordova prepare (or any command containg this, as $cordova run, $cordova build, ...) you would loose your changes.
Never edit JavaScript-Code directly in your /myApp/platforms/(anyplatform)/www/ folder. Always use /myApp/www/ and run $cordova prepare afterwards...
After step 5 you could use $cordova emulate android (for your avd) or cordova run android (real device), which would replace all other steps. However, if there are errors coming up, finding the reasons might be more difficult.
If your questions was over how to configurate the android app (platform merges, manifest configurations, ...) feel free to ask again :)
Regards, miweiss
I builded phonegap application with ant.
I think that this is not a big deal to build it with eclipse. You should copy web resources to the platforms/android/assets/www folder. Then you should use platforms/android as your project folder. I think you can use symbolic or hard links instead of copying to always refer to actual data.

Deploying Phonegap / Cordova app for Android?

I've got a Phonegap/Cordova 3.0 app that I am testing on Android.
Since version 2.x, Cordova relies heavily on the command-line terminal. I've done all the setup stuff and I can build the app. But two things are troubling me.
First of all, an Android project has two www folders. One is [myproject]/www. The other is [myproject]/platforms/android/assets/www. I'm not sure which of these folders to edit when I am fixing bugs.
If I am correct, the first one is where you place your app files before using the command-line "cordova build" to create the app. The second one should then be only a copy that's used after building, before deploying.
Now my question is, when I make a change to my app and I want to test on device, do I have to use the command line to (re)build the app every time?
[myproject]/www is the directory in which you should put your source files. When you build your app these files are copied in to [myproject]/platforms/[platform]/assets/www. In addition to this, files in [myproject]/platforms/[platform] are also copied to [myproject]/platforms/[platform]/assets/www, which allows you to create per-platform overrides to your files.
Note that you should never edit files in [myproject]/platforms/[platform]/assets/www directly, as they will be deleted next time you build your project.
To run your project on your device use cordova run [platform], or to run it on an emulator use cordova emulate [platform].
I found a solution: in command-line terminal, type cordova run android and the app will be built, deployed and run on device.
Hi First thing : Edit www folder inside the asset folder.
Second : no need of command line build , you can take build via eclipse its very easy, Right click on project root folder --> Run As -> Android Application

How do I export an Android Studio project?

I just started using the Android Studio IDE and I already released and published a simple APK to Google Play store.
The problem is that I did this at work.
Now I downloaded the Android Studio at my home and I want to continue working and fixing bugs on my Project.
I see that there is Import Project in the Android Studio home screen, but from where I export the project in order to import it?
I tried Zipping my whole Project folder and import it but it didn't work very well.
In the Android Studio go to File then Close Project. Then take the folder (in the workspace folder) of the project and copy it to a flash memory or whatever. Then when you get comfortable at home, copy this folder in the workspace folder you've already created, open the Android Studio and go to File then Open and import this project into your workspace.
The problem you have with this is that you're searching for the wrong term here, because in Android, exporting a project means compiling it to .apk file (not exporting the project). Import/Export is used for the .apk management, what you need is Open/Close project, the other thing is just copy/paste.
As mentioned by other answers, as of now android studio does not provide this out of the box. However, there are ways to do this easily.
As mentioned by #Elad Lavi, you should consider cloud hosting of your source code. Checkout github, bitbucket, gitlab, etc. All these provide private repositories, some free, some not.
If all you want is to just zip the sources, you can achieve this using git's git archive. Here are the steps:
git init # on the root of the project folder
git add . # note: android studio already created .gitignore
git commit -m 'ready to zip sources'
git archive HEAD --format=zip > /tmp/archive.zip
Note: If you intend to send this by email, you have to remove gradlew.bat from zip file.
Both these solutions are possible thanks to VCS like git.
It seems as if Android Studio is missing some features Eclipse has (which is surprising considering the choice to make Android Studio official IDE).
Eclipse had the ability to export zip files which could be sent over email for example.
If you zip the folder from your workspace, and try to send it over Gmail for example, Gmail will refuse because the folder contains executable.
Obviously you can delete files but that is inefficient if you do that frequently going back and forth from work.
Here's a solution though:
You can use source control. Android Studio supports that. Your code will be stored online.
A git will do the trick. Look under "VCS" in the top menu in Android Studio.
It has many other benefits as well. One of the downsides though, is that if you use GitHub for free, your code is open source and everyone can see it.
Source control is best way to handle this problem, if you don't want to pay then try bitbucket
It's free, allows private repo for upto 5 members team.
Windows:
First Open Command Window and set location of your android studio project folder like:
D:\MyApplication>
then type below command in it:
gradlew clean
then wait for complete clean process. after complete it now zip your project like below:
right click on your project folder
then select send to option now
select compressed via zip
Apparently, there's a lot of "dead wood" in the "build" directories of a project.
Under linux/unix, a simple way to get a clean, private backup is to use the "tar" command along with the "--exclude=String" option.
For example, to create an archive of all my apps while excluding the build directories, I have a script that creates the following 2 commands :
cd $HOME/android/Studio
tar cvf MyBackup-2017-07-13.tar Projects --exclude=build
For Android Studio below 4.1:
From the Top menu Click File and then click Export to Zip File
For Android Studio 4.1 and above:
From the Top menu click File > Manage IDE Settings > Export to Zip File ()

How do I make a basic App Engine Connected Android Project?

I'm new to this, so please bear with me. I simply want to get the basic App Engine Connected Android Project to work in eclipse.
I first downloaded Eclipse 3.7 and the Android SDK. I installed the ADT plugin through eclipse. I configured eclipse to point to the sdk and created an android project. I added some widgets, messed around with SMS messages, and ran it on my phone. Worked like a charm.
Then I decided it was time to work with app engine. I downloaded the Google plugin for eclipse from within eclipse using this link http://dl.google.com/eclipse/plugin/3.7. I also downloaded the Google App Engine Java SDK from that link.
Ok, here's where it gets more fun. I created a new app engine connected android project and named it "TestProjectThree". I then clicked "Debug as->local app engine connected android project". On the console I got a url, but on my phone I got a black screen. I then noticed that there was nothing in the android/gen folder, so I did a clean build of both projects. Suddenly, it gave me 10 warnings.
"Cannot fully validate context since domain type com.testprojectthree.server.HelloWorldService is not available.
You must run the ValidationTool as part of your server build process."
I googled the problem and found this link http://code.google.com/p/google-web-toolkit/wiki/RequestFactoryInterfaceValidation.
I began following the instructions. I tried to enable annotation processing, but it was already enabled. I tried to add the requestfactory-apt.jar to the factory path, but it was already there too.
Apparently now I need to run something called an Annotation Processor. I've never used Maven before but I right click on my android project->configure->convert to Maven project. I do a clean build and a POM file appears. I then copy all of the XML from that link to the line right above the /project line in the POM file. I copy the second bit too because I'm using indigo. Clean and build again. New error.
"/TestProjectThree-Android/gen already exists but is not a source folder. Convert to a source folder or rename it."
No idea what that one means either, but I see right click gen->build path->convert to source folder so I click that too. Clean and build again. NO ERRORS!! YAYAYAY!!!
Debug as local app engine connected android project. Got a black screen on the phone, and some sort of error in eclipse. “Source not found”. Looked for a more detailed error message but the console just has the app engine url on it and logcat looks empty.
I went back to the link about the validation tool and read all the comments. A lot of people seemed confused. I have no idea if I did it right, or did any of it right, and am very lost now. Please please please help me!!!
This sounds very similar to a problem I had, although not exactly.
I think the code generated by the AppEngine project that is used by the Android project is either not generated correctly, or needs a refresh.....and clean doesn't do it.
Try this:
First, make sure the requestfactory-apt.jar was in the "Factory Path" of "Annotation Processing" in the "Java Compiler" section of Project Properties.
In AppEngine project.
Properties-> Java Build Path, Source section. Select the ".apt_generated" entry and then "edit…" and rename it, by putting a "1" at the end of the name (or whatever).
Project -> Clean
then in Android Project
Properties-> Java Build Path, Source section.
Select the "apt_generated" source folder that is linked to the ".apt_generated" source folder in the AppEngine project.
"Edit…", then in the first line "Linked Folder Location" navigate to the NEWLY named folder in the AppEngine project (the one with the "1" at the end……)
Then Project -> Clean
Then build & run your Android project, it should now have newly generated RequestFactory code from AppEngine project and validate OK at runtime.
It's possible that closing and opening projects and cleans were also required.
Use parse. I tried using AppEnging for my app's backend, but parse seems to take care of a lot of backend jobs and makes life extremely easy https://parse.com

Categories

Resources