This is a migrated thread and some comments may be shown as answers.

Google Play Services

12 Answers 131 Views
Google Android
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Josh
Top achievements
Rank 1
Josh asked on 25 Feb 2015, 11:10 PM
I am needing to install a custom plugin that requires Google Play Services, on Google, https://developer.android.com/google/play-services/setup.html, it says I need to set up the Google Play Services SDK in my android project. 

On this page: http://docs.telerik.com/platform/backend-services/development/android-sdk/users/oauth-providers, it says I can install Google Play Services from the Android SDK Manager.

How can I do this using AppBuilder? 

12 Answers, 1 is accepted

Sort by
0
Anton Dobrev
Telerik team
answered on 27 Feb 2015, 03:47 PM
Hello Josh,

Straight to your questions.

1. The official Google documentation is referring to native Android projects and does not explain the way how to do this in Apache Cordova projects (as in Telerik AppBuilder). I will come back to this in point 3.

2. Again, the documentation of Telerik Backend Services explains how to add the Google Play Services SDK in a native Android project.

3. I am afraid that this is not exactly documented. It would be helpful to share information about the plugin and what are the exact requirements for its installation. I am guessing that you need to use some of the Google APIs like Maps, for example, is that right?

Note that custom plugins should be Plugman-compatible if you want to use them within an AppBuilder project. Here is the documentation article about this.

It is a common practice that plugins keep a reference to their dependencies within them. If this is not the case, here are three approaches that will add the Google Play Services SDK to your AppBuilder project.

1. Import the SDK in question manually in the project.

Download the SDK as explained in the Android docs and place it in the platforms/android folder of the plugin. Then add a node in the <platform> tag with the path to the SDK path in the plugin.xml (or modify the existing one) that should look like:

<platform name="android">
// other tags
 
 <framework src="platforms/android/MyCustomLibFolder" custom="true" />
 
</platform>

2. Install another custom plugin in the AppBuilder project that adds the SDK

Adding the SDK could be achieved by adding another plugin which is made just for this purpose. Importing such plugin mimics the action of importing the SDK in a native project.

Example of such plugin that imports the Google Play Services SDK is this one - https://github.com/MobileChromeApps/google-play-services.

3. Add the SDK "virtually" as a dependency

You can also add a <dependency> element in the plugin.xml like this:

<!-- android -->
    <platform name="android">
 
     // other configs
 
       <dependency id="com.google.playservices" url="https://github.com/MobileChromeApps/google-play-services" commit="master" />
  
</platform>

Thus with each build the plugin that imports the Google Play Services SDK will be referenced and the plugin you are trying to import will be functioning as the SDK is installed locally.

I hope that this is helpful. Which way you will go depends mostly on the control you would like to have on the SDK version and on your project. For example, consider to clone the GitHub repositories under your account, to take responsibility to update the SDK jar file manually when needed, etc..

Note that in all approaches the size of the SDK will be added to your app package.

Let me know if further questions arise.

Best regards,
Anton Dobrev
Telerik
 

Visit the Telerik Verified Plugins Marketplace and get the custom Cordova plugin you need, already tweaked to work seamlessly with AppBuilder.

 
0
Josh
Top achievements
Rank 1
answered on 02 Mar 2015, 08:37 PM
Thank you for your reply.

The plugin I am attempting to install is https://github.com/radiumone/r1-connect-demo-phonegap

I've gone through the docs and it appears to be plugman compatible. I will go through this process and see if I can get it working. 
0
Josh
Top achievements
Rank 1
answered on 02 Mar 2015, 08:37 PM
Does anyone else get an error every single time they post to this forum?
0
Josh
Top achievements
Rank 1
answered on 02 Mar 2015, 11:04 PM
So I'm getting an error:

Error: Failed to install 'com.radiumone.R1Connect.phonegap':Error: grafting xml at selector "/widget" from "/tmp/23e1bf6ab8df4274877aa51630b90261/res/xml/config.xml" during config install went bad :(
    at ConfigFile_graft_child [as graft_child] (/home/builder/BpcTooling/Cordova3/3.7.0/node_modules/plugman/node_modules/cordova-lib/cordova-lib/src/plugman/util/config-changes.js:591:19)
    at PlatformMunger_apply_file_munge [as apply_file_munge] (/home/builder/BpcTooling/Cordova3/3.7.0/node_modules/plugman/node_modules/cordova-lib/cordova-lib/src/plugman/util/config-changes.js:170:38)
    at PlatformMunger.add_plugin_changes (/home/builder/BpcTooling/Cordova3/3.7.0/node_modules/plugman/node_modules/cordova-lib/cordova-lib/src/plugman/util/config-changes.js:270:14)
    at /home/builder/BpcTooling/Cordova3/3.7.0/node_modules/plugman/node_modules/cordova-lib/cordova-lib/src/plugman/util/config-changes.js:393:14
    at Array.forEach (native)
    at PlatformMunger_process [as process] (/home/builder/BpcTooling/Cordova3/3.7.0/node_modules/plugman/node_modules/cordova-lib/cordova-lib/src/plugman/util/config-changes.js:392:45)
    at Object.exports.process (/home/builder/BpcTooling/Cordova3/3.7.0/node_modules/plugman/node_modules/cordova-lib/cordova-lib/src/plugman/util/config-changes.js:81:12)
    at Object.handlePrepare (/home/builder/BpcTooling/Cordova3/3.7.0/node_modules/plugman/node_modules/cordova-lib/cordova-lib/src/plugman/prepare.js:72:20)
    at /home/builder/BpcTooling/Cordova3/3.7.0/node_modules/plugman/node_modules/cordova-lib/cordova-lib/src/plugman/install.js:599:21
    at _fulfilled (/home/builder/BpcTooling/Cordova3/3.7.0/node_modules/plugman/node_modules/q/q.js:787:54)
grafting xml at selector "/widget" from "/tmp/23e1bf6ab8df4274877aa51630b90261/res/xml/config.xml" during config install went bad :(

/home/builder/BpcTooling/Cordova3/node_modules/cordova-build-utils/bin/install-plugins-3.js:166
throw Error("exit code: " + code);
     ^
Error: exit code: 1
    at Error (<anonymous>)
    at ChildProcess.<anonymous> (/home/builder/BpcTooling/Cordova3/node_modules/cordova-build-utils/bin/install-plugins-3.js:166:13)
    at ChildProcess.emit (events.js:98:17)
    at Process.ChildProcess._handle.onexit (child_process.js:810:12)

Done building project "Couwalla.tmp.proj" -- FAILED.

[2015-03-02 16:54:40.624] Log (Exception,High): System.Exception: Could not receive PList header.



Does this look like the plugin is not plugman compatible or should I direct my question to the plugin creator?

0
Anton Dobrev
Telerik team
answered on 04 Mar 2015, 11:20 AM
Hello Josh,

I managed to install the plugin within an AppBuilder project using Cordova 3.5 and 3.7 and successfully executed a build in the cloud with this plugin.

All you need to do is to:
 - Download the ZIP archive of the plugin's repository on your local machine
 - Open your AppBuilder project
 - Open the Project Navigator pane in the right and right-click the Plugins folder
 - Select Import plugin and navigate to the ZIP archive on your hard drive.
 - Select the ZIP file with the plugin and upload it.

Now you should be able to use the plugin within your AppBuilder project.

Could you please double check the above on your side?

Regards,
Anton Dobrev
Telerik
 

Visit the Telerik Verified Plugins Marketplace and get the custom Cordova plugin you need, already tweaked to work seamlessly with AppBuilder.

 
0
Josh
Top achievements
Rank 1
answered on 05 Mar 2015, 12:22 AM
Anton,

Thanks for your help. So I re-downloaded the plugin and tried this process again. It builds now for some unknown reason, but when I try to use it I get "[Error] ReferenceError: Can't find variable: R1SDK" in the console. 

I installed and built locally with phonegap CLI and the same code worked - no errors when calling R1SDK. Do I have to do something more to initialize it? Shouldn't have to because it uses js-module instead of asset, right?
0
Josh
Top achievements
Rank 1
answered on 05 Mar 2015, 01:41 PM
Edit, rebuilt this morning and it seems to work now.
0
Anton Dobrev
Telerik team
answered on 06 Mar 2015, 11:40 AM
Hello Josh,

Glad to hear that this is now working on your side.

Let me know if you have questions.

Regards,
Anton Dobrev
Telerik
 

Visit the Telerik Verified Plugins Marketplace and get the custom Cordova plugin you need, already tweaked to work seamlessly with AppBuilder.

 
0
Josh
Top achievements
Rank 1
answered on 18 Mar 2015, 03:14 PM
Hey, revisiting this - when I got this to build, it only built for iOS. I still can not build for Android. I download the plugin, import into plugins using the windows appbuilder client, and it gives me this error:

Failed to install 'com.radiumone.R1Connect.phonegap':Error: grafting xml at selector "/widget" from "/tmp/05b4aae1339e4ff2a7faa3bb18c188dd/res/xml/config.xml" during config install went bad :(
at ConfigFile_graft_child [as graft_child] (/home/builder/BpcTooling/Cordova3/3.7.0/node_modules/plugman/node_modules/cordova-lib/cordova-lib/src/plugman/util/config-changes.js:591:19)
at PlatformMunger_apply_file_munge [as apply_file_munge] (/home/builder/BpcTooling/Cordova3/3.7.0/node_modules/plugman/node_modules/cordova-lib/cordova-lib/src/plugman/util/config-changes.js:170:38)
at PlatformMunger.add_plugin_changes (/home/builder/BpcTooling/Cordova3/3.7.0/node_modules/plugman/node_modules/cordova-lib/cordova-lib/src/plugman/util/config-changes.js:270:14)
at /home/builder/BpcTooling/Cordova3/3.7.0/node_modules/plugman/node_modules/cordova-lib/cordova-lib/src/plugman/util/config-changes.js:393:14
at Array.forEach (native)
at PlatformMunger_process [as process] (/home/builder/BpcTooling/Cordova3/3.7.0/node_modules/plugman/node_modules/cordova-lib/cordova-lib/src/plugman/util/config-changes.js:392:45)
at Object.exports.process (/home/builder/BpcTooling/Cordova3/3.7.0/node_modules/plugman/node_modules/cordova-lib/cordova-lib/src/plugman/util/config-changes.js:81:12)
at Object.handlePrepare (/home/builder/BpcTooling/Cordova3/3.7.0/node_modules/plugman/node_modules/cordova-lib/cordova-lib/src/plugman/prepare.js:72:20)
at /home/builder/BpcTooling/Cordova3/3.7.0/node_modules/plugman/node_modules/cordova-lib/cordova-lib/src/plugman/install.js:599:21
at _fulfilled (/home/builder/BpcTooling/Cordova3/3.7.0/node_modules/plugman/node_modules/q/q.js:787:54)
grafting xml at selector "/widget" from "/tmp/05b4aae1339e4ff2a7faa3bb18c188dd/res/xml/config.xml" during config install went bad :(

/home/builder/BpcTooling/Cordova3/node_modules/cordova-build-utils/bin/install-plugins-3.js:166
throw Error("exit code: " + code);
^
Error: exit code: 1
at Error ()
at ChildProcess. (/home/builder/BpcTooling/Cordova3/node_modules/cordova-build-utils/bin/install-plugins-3.js:166:13)
at ChildProcess.emit (events.js:98:17)
at Process.ChildProcess._handle.onexit (child_process.js:810:12)
N/ACouwalla00C#N/A


I'm going to keep playing with it, because the alternative is to do what I'm currently doing, building using appbuilder for iOS, then downloading the code from appbuilder, copying into my local android project folder, and using phonegap cli to build for android, which is pretty annoying. 

Any ideas on this?

Thanks!
0
Anton Dobrev
Telerik team
answered on 23 Mar 2015, 11:46 AM
Hi Josh,

The error derives from this line of the plugin config.

Changing this line to
<config-file target="config.xml" parent="/*">

should fix the issue.

Let me know if this works for you.

Regards,
Anton Dobrev
Telerik
 

Visit the Telerik Verified Plugins Marketplace and get the custom Cordova plugin you need, already tweaked to work seamlessly with AppBuilder.

 
0
Josh
Top achievements
Rank 1
answered on 23 Mar 2015, 10:36 PM
Hey,

I just switched to using Urban Airship, but it had the same problem. http://urbanairship.com/resources/developer-resources

Turns out it has the same line, so I tried your fix. Worked to a point, the app now builds - however, the program doesn't even get open and it stops with "Unfortunately, app has stopped". Open the app again by tapping the icon, shows a black screen and just closes. Try to build again and I get "Failed to deploy application com.app.android to SCH-I545: INSTALL_FAILED_UID_CHANGED."

Any ideas?
0
Anton Dobrev
Telerik team
answered on 26 Mar 2015, 11:07 AM
Hi Josh,

Let me address your inquiries below. These are two separate errors but my assumption here is that none of them is connected to the fix applied in the plugin. Using a "/*" path is the recommended way in the latest versions of Cordova.

1. The "Unfortunately, app has stopped" error message

Most probably this error is produced by the new plugin. Unfortunately, it is not clear what is the error in the code that is causing the message.

I tested with the plugin in question and after adding successfully a .properties file with the project keys configuration settings I was able to build and deploy correctly. Hope that this could solve the issue on your side.

However, while starting the app it crashed and I received another exception that stands for an opened window by the plugin's native code that was not closed. That is why I'd recommend that you install the Android Device Monitor and observe the errors send from your application while its is running on your connected Android device.

2. The "INSTALL_FAILED_UID_CHANGED" error message

Unfortunately, this appears to be a commonly know issue in the Android world and is also covered in this Telerik forum thread - http://www.telerik.com/forums/%27build-and-deploy%27-to-android-device-suddenly-fails

I hope that the solutions proposes in the thread will work for you as well.

Regards,
Anton Dobrev
Telerik
 

Visit the Telerik Verified Plugins Marketplace and get the custom Cordova plugin you need, already tweaked to work seamlessly with AppBuilder.

 
Tags
Google Android
Asked by
Josh
Top achievements
Rank 1
Answers by
Anton Dobrev
Telerik team
Josh
Top achievements
Rank 1
Share this question
or