Pender Android for Phonegap Cordova

Discussion and feedback on Construct 2

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

Post » Wed Mar 20, 2013 6:56 am

[QUOTE=ArcadEd] 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.

[/QUOTE]

great! Do you have an android device handy?
B
4
Posts: 40
Reputation: 382

Post » Wed Mar 20, 2013 6:59 am

I do, I'm on the final few steps and I'll give it a whirl
B
94
S
29
G
11
Posts: 1,545
Reputation: 20,993

Post » Wed Mar 20, 2013 7:02 am

[QUOTE=ArcadEd] I do, I'm on the final few steps and I'll give it a whirl
[/QUOTE]

woot!
B
4
Posts: 40
Reputation: 382

Post » Wed Mar 20, 2013 7:03 am

Ok, I'm up to the build part. I've done everything in the past in Eclipse, what would be the command to build?

Or should I just use eclipse?
B
94
S
29
G
11
Posts: 1,545
Reputation: 20,993

Post » Wed Mar 20, 2013 7:07 am

[QUOTE=ArcadEd] Ok, I'm up to the build part. I've done everything in the past in Eclipse, what would be the command to build?

Or should I just use eclipse?[/QUOTE]

Step 11: run ant build
Step 12: adb install bin/yourapkfile.apk

running in eclipse is fine, I have to resort to it to debug :)
Just be warned, eclipse will give you a bunch of bullsh*t errors which aren't actually errors.

command line is quick, try it out, but open up eclipse and "file->import" the example and library project anyway.

That way you can step through the code on the native side, if you like.
B
4
Posts: 40
Reputation: 382

Post » Wed Mar 20, 2013 7:10 am

Yeah, I can't seem to find an ant command. Always non recognized command.
B
94
S
29
G
11
Posts: 1,545
Reputation: 20,993

Post » Wed Mar 20, 2013 7:18 am

oh, one thing I should mention:

there is an irritating issue that took a long time to solve: specify a min-sdk version in the manifest. Otherwise, the onSurfaceChanged function in the renderer misreports the device screen size, and you get smaller canvas. Pender handles this gracefully (no crash, no error) but it won't do the demo justice :)


--edit-- ok, no ant. It must be *somewhere* on your system, as that's what the Eclipse Android SDK plugin uses as a backend, but let's not worry about that. Just go "file->import" and choose import existing Android project. Import both the ExampleProject and the PenderLibraryProject


--edit 2--

for the manifest, open AndroidManifest.xml, and right under the top Manifest tag, put:
    <uses-sdk android:minSdkVersion="8" />

that'll prevent the canvas shrinkage issue :)lorinbeer2013-03-20 07:24:26
B
4
Posts: 40
Reputation: 382

Post » Wed Mar 20, 2013 7:24 am

OK, importing as existing project doesn't work. I choose the directory (Either one) and it doesn't give me the option to import. No Projects to Import. I can do import existing android code though.ArcadEd2013-03-20 07:25:52
B
94
S
29
G
11
Posts: 1,545
Reputation: 20,993

Post » Wed Mar 20, 2013 7:25 am

[QUOTE=ArcadEd] OK, importing as existing project doesn't work. I choose the directory (Either one) and it doesn't give me the option to import. I can do import existing android code though.[/QUOTE]

yeah, that's the one. Existing project looks for an Eclipse project, which hasn't been created yet. Import android code is the option we wantlorinbeer2013-03-20 07:25:47
B
4
Posts: 40
Reputation: 382

PreviousNext

Return to Construct 2 General

Who is online

Users browsing this forum: Artpunk, newt and 10 guests