Showing posts with label Android app. Show all posts
Showing posts with label Android app. Show all posts

Saturday, June 21, 2014

Adding/integrating Google play services with Android app project

When adding the below element tag to AndroidManifest.xml file

<meta-data  android:name="com.google.android.gms.version"
 android:value="@integer/google_play_services_version" />
 

If you see the below error message then it means that Google play services library is not present for the current Android project.
The error is:
   No resources found that match the given name (at 'value' with value '@integer/google_play_services_version').


 To add Google play services lib, follow the below steps
1)      Select File -> Import
2)      browse to the folder where ‘Google play services library’ is present
3)      Note: ‘Google play services library’ is located in \sdk\extras\google\google_play_services
4)      select ‘Google play services library’ and ‘copy project into workspace’
Note: “copy project into workspace” must be selected so that the lib does not get modified
5)      right on your project -> properties -> android -> library and select the Google play services lib
6)      Rebuild your project which will clear the error







.

Wednesday, April 30, 2014

Adding external/third party jars to Android project in libs folder


  1. Download the jar files to your computer.
  2. Create a new folder, libs, in your Eclipse/Android project (if it does not exist)
  3. Right-click libs and choose Import -> General -> File System, then Next, Browse in the filesystem to find the parent directory where the jar(s) were downloaded.
  4. Click OK, then click the directory name (not the checkbox) in the left pane, then check the relevant JAR in the right pane. This puts the library into your project.
  5. Right-click on your project, choose Build Path -> Configure Build Path, then click the Libraries tab, then Add JARs..., navigate to your new JAR in the libs directory and add it.This step is when the new jar gets converted to a Dalvik-converted JAR that can be used with the Android project.

Friday, April 11, 2014

Android app emulator for pc



The Android app emulator is really good to do some pre-testing of android apps before installing it on your device.After all you do not want to cause your mobile to crash :P

The Android app emulator really takes some time to startup and be fully functional. Startup time ranges between 5-10min as it has to load all associated functions that might be invoked.

Emulator started at 5.47pm


Fully functional emulator at 5.52pm

Once launched, you can use it just as you use the app on the mobile device. Mobile app testing signoff should always be done on using targeted devices.

Once launched properly, you should see logs similar to the ones below:
[2014-04-06 17:53:20 - TestApp] Android Launch!

[2014-04-06 17:53:20 - TestApp] adb is running normally.


Installing an apk file through Eclipse or from command line, should produce logs similar as the ones below:
[2014-04-06 17:53:25 - TestApp] Uploading TestApp.apk onto device 'emulator-5554'

[2014-04-06 17:53:26 - TestApp] Installing TestApp.apk...

[2014-04-06 17:53:37 - TestApp] Success!

[2014-04-06 17:53:37 - TestApp] Starting activity com.bertie.testapp.MainActivity on device emulator-5554

[2014-04-06 17:53:41 - TestApp] ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.xyz.testapp/.MainActivity }


Troubleshooting tips:

1) Installation error, Launch failed on device, etc
This means that the android emulator is still not fully operational and you are trying to deploy/install an app on it. You will get something like the below error logs
[2014-04-06 18:10:47 - MainActivity] Installation error: Unknown failure
[2014-04-06 18:10:47 - MainActivity] Please check logcat output for more details.
[2014-04-06 18:10:47 - MainActivity] Launch failed on device: AVD_for_Nexus_5_by_Google

2) No active compatible AVD's or devices found
This means that the emulator is not running or is not responding
[2014-04-12 10:40:47 - WebView] Performing com.example.android.webview.MainActivity activity launch
[2014-04-12 10:40:47 - WebView] No active compatible AVD's or devices found. Relaunch this configuration after connecting a device or starting an AVD.

Saturday, April 5, 2014

Import/Open existing android app project in Eclipse

Most of the time when we try to import/open a downloaded eclipse project, we get the error message “… overlaps the location of another project ..”

Eclipse is showing an error message because you are trying to create a new project on a existing directory that already contains a project. Eclipse is trying to save you from losing work.!!
  
Incorrect steps to import existing Eclipse project:
1)      Extract downloaded SimpleCalendarApp.zip in E:\workspace-adt
2)      Extracted zip creates a folder E:\workspace-adt\SimpleCalendarApp
3)      Launch Eclipse
4)      File --> import --> Android “existing android code into workspace”
5)      Root directory : select E:\workspace-adt
6)      Select project “SimpleCalendarApp”
7)      Click Finish
8)      Displays error message “… overlaps the location of another project ..”





 Eclipse is showing an error message because you are trying to create a new project on a existing directory that already contains a project. Eclipse is trying to save you from losing work J.


Correct Steps to import existing Eclipse project:
1)      Extract downloaded zip in c:\temp
2)      Extracted zip creates a folder c:\temp\SimpleCalendarApp
3)      Launch Eclipse
4)      File --> import --> Android “existing android code into workspace”
5)      Root directory : select c:\temp
6)      Select project “SimpleCalendarApp”
7)      The project is created in Eclipse.