Pender Android for Phonegap Cordova

Discussion and feedback on Construct 2

Post » Wed Mar 20, 2013 6:10 am

My pleasure! Let me know how it goes!
B
4
Posts: 40
Reputation: 382

Post » Wed Mar 20, 2013 6:22 am

@lorinbeer

Well, maybe you can shine some light on the errors I get when just trying to do the create. I'm using git bash in windows.

Maybe an example of how the command line would look for an existing project?

PenderTools: Creating Client Project
./create: line 119: android: command not found
grep: invalid option -- o
Usage: grep [OPTION]... PATTERN [FILE]...
Try `grep --help' for more information.

android create lib-project --name Pender --target 0 --path PenderAndroidLibrary
--package com.pender
./create: line 100: android: command not found
executing curl on https://sourceforge.net/projects/penderstaticlib/files/rhino1_7R5pre.jar

% Total    % Received % Xferd Average Speed   Time    Time     Time Current
                                 Dload Upload   Total   Spent    Left Speed
0   325    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
0   343    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
0   425    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
0     0    0     0    0     0      0      0 --:--:-- 0:00:01 --:--:--     0
0 1115k    0     0    0     0      0      0 --:--:-- 0:00:01 --:--:--     0
Warning: Failed to create the file PenderAndroidLibrary/libs/rhino1_7Rpre.jar:
Warning: No such file or directory
0 1115k    0 4150    0     0   2830      0 0:06:43 0:00:01 0:06:42 270k
curl: (23) Failed writing body (0 != 4150)
./create: line 119: android: command not found
grep: invalid option -- o
Usage: grep [OPTION]... PATTERN [FILE]...
Try `grep --help' for more information.

0
android update project --path PenderClient --library ../PenderAndroidLibrary
./create: line 112: android: command not foundArcadEd2013-03-20 06:26:31
B
94
S
29
G
11
Posts: 1,545
Reputation: 20,993

Post » Wed Mar 20, 2013 6:31 am

ugh, that's ugly. You're running this on a windows machine, aren't you? :)

grep should be available for cygwin, that will enable the build tool to run the 'android' tool. The create script using grep to swap out arguments. The failure of curl is also likely a platform issue.

What we need is native windows build tools, but that will take a day at least. Let's see if we can't do this manually.

first let's run android and create our projects

1. android create lib-project --name Pender --target <targetid> --path <path> --package com.pender

where "<targetid>" is replaced with the latest android target and "<path>" is the desired path to the project, call it PenderAndroidLibrary

2. android create project --target <targetid> --path <path> --package <package> --activity <activityid>

where "<targetid>" = latest android target
          "<path>" = path to project, should be same dir as the Library Project
          "<package>" = com.pender.example or whatever you want to call your example
          "<activityid>" = name of the main activity of the example, let's go with ArcadeEdlorinbeer2013-03-20 06:37:24
B
4
Posts: 40
Reputation: 382

Post » Wed Mar 20, 2013 6:34 am

I have a mac also if that makes things easier :).

So by Targetid are you referring to an APK? I'm sorry, I'm feeling like a noob here. Out of my comfort zone for sure :). I'll try it like that :)
B
94
S
29
G
11
Posts: 1,545
Reputation: 20,993

Post » Wed Mar 20, 2013 6:36 am

3. next copy the source from the root of the repo to the root of the library project
cp -r pender-android/src /path/to/your/pender/library/project/src

so if you made the pender library in PenderAndroidLibrary in the same directory as the git repo, the command would be:

cp -r pender-android/src PenderAndroidLibrary/src

4. next download the Rhino lib: https://sourceforge.net/projects/penderstaticlib/files/rhino1_7R5pre.jar

5. put the rhino1_7R5pre.jar file downloaded in 4 in PenderAndroidLibrary/libs


yeah, target id is the APK, type: "android list targets" to get a full list of the targets installed on your system.lorinbeer2013-03-20 06:39:31
B
4
Posts: 40
Reputation: 382

Post » Wed Mar 20, 2013 6:39 am

OK, I figured out what target meant :). One step 2. Woot!
B
94
S
29
G
11
Posts: 1,545
Reputation: 20,993

Post » Wed Mar 20, 2013 6:46 am

[QUOTE=ArcadEd] OK, I figured out what target meant :). One step 2. Woot![/QUOTE]

yeAH!

almost done!

6. update the example project so it references the library
android update project --path <path> --library <libloc>

"<path>" is path to your project
"<libloc>" is path to your library

assuming you've made both in the same toplevel directory as the repo, the command would be:

android update project --path PenderExample --library PenderAndroidLibrary

for project called PenderExample

7. next copy over the assets directory to the client project, not the library
cp -r pender-android/assets PenderExample/assets

for project called PenderExample
B
4
Posts: 40
Reputation: 382

Post » Wed Mar 20, 2013 6:48 am

OK, got 2 step 5 I believe :)
B
94
S
29
G
11
Posts: 1,545
Reputation: 20,993

Post » Wed Mar 20, 2013 6:50 am

OK, I think I got confused. What path to my project? Is one of my projects that i have complated? In APK?

Nevermind, I think I got it now. reread all the steps and it's making more sense.

ArcadEd2013-03-20 06:53:35
B
94
S
29
G
11
Posts: 1,545
Reputation: 20,993

Post » Wed Mar 20, 2013 6:53 am

finally, we build our project. Now, I haven't a hot clue if this will work: I think ant is distributed with the Android SDK. Let's find out:

9. open the main activity for the example project in an editor
look in PenderExample/src and follow the directory tree down to the activity
open up the activity located in PenderExample/src/com/pender/example/exampleactivity.java

10. replace everything under the package statement with:

import android.app.Activity;
import android.os.Bundle;

import com.pender.Pender;

public class PenderActivity extends Activity
{
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        mPender = new Pender(this);
        mPender.init();
    }

    private Pender mPender;    
}

11. build your project,from your PenderExample root, run

ant debug

12. install on a device

adb install bin/blah.apk

where blah.apk will be something like PenderExample-debug.apk


Alternatively to step 11, you can now import the Library and Example project to eclipse, and let it build and install for you
B
4
Posts: 40
Reputation: 382

PreviousNext

Return to Construct 2 General

Who is online

Users browsing this forum: blackant, Eisenhans, Prominent, shinichild and 10 guests