Skip to content

Commit 6bfc513

Browse files
committed
updating for newer android sdk tools
1 parent 49a5126 commit 6bfc513

7 files changed

Lines changed: 64 additions & 32 deletions

File tree

android/todo.txt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
0202 android
2-
2+
X fix problem with export menu, keys, toolbar being different
3+
X change default package name a bit
4+
X switch to SDK 8 (Android 2.2) as the minimum
5+
X update the project files for Android SDK Tools Revision 15 (now required)
6+
7+
_ launching on emulator not working well
8+
_ Latest android sdk breaks processing - new build.xml output required
9+
_ http://code.google.com/p/processing/issues/detail?id=876
310

411
_ if a sketch asks for android mode but it's not available
512
_ (after a double-click)

app/lib/ant-launcher.jar

10 Bytes
Binary file not shown.

app/lib/ant.jar

410 KB
Binary file not shown.

app/src/processing/mode/android/AndroidBuild.java

Lines changed: 51 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@
3333

3434

3535
class AndroidBuild extends JavaBuild {
36-
static final String basePackage = "processing.android.test";
37-
static final String sdkVersion = "7";
36+
static final String basePackage = "processing.changethispackage.beforesubmittingtothemarket";
37+
static final String sdkVersion = "8";
3838
static final String sdkTarget = "android-" + sdkVersion;
3939

4040
// private final Editor editor;
@@ -129,13 +129,17 @@ public File createProject() throws IOException, SketchException {
129129
File tempManifest = new File(tmpFolder, "AndroidManifest.xml");
130130
manifest.writeBuild(tempManifest, sketchClassName, target.equals("debug"));
131131

132-
writeBuildProps(new File(tmpFolder, "build.properties"));
132+
writeAntProps(new File(tmpFolder, "ant.properties"));
133133
buildFile = new File(tmpFolder, "build.xml");
134134
writeBuildXML(buildFile, sketch.getName());
135-
writeDefaultProps(new File(tmpFolder, "default.properties"));
135+
writeProjectProps(new File(tmpFolder, "project.properties"));
136136
writeLocalProps(new File(tmpFolder, "local.properties"));
137137
writeRes(new File(tmpFolder, "res"), sketchClassName);
138138

139+
File proguardSrc = new File(sdk.getSdkFolder(), "tools/lib/proguard.cfg");
140+
File proguardDst = new File(tmpFolder, "proguard.cfg");
141+
Base.copyFile(proguardSrc, proguardDst);
142+
139143
final File libsFolder = mkdirs(tmpFolder, "libs");
140144
final File assetsFolder = mkdirs(tmpFolder, "assets");
141145

@@ -242,14 +246,19 @@ protected File createExportFolder() throws IOException {
242246

243247

244248
public File exportProject() throws IOException, SketchException {
245-
File projectFolder = build("debug");
246-
if (projectFolder == null) {
247-
return null;
249+
// File projectFolder = build("debug");
250+
// if (projectFolder == null) {
251+
// return null;
252+
// }
253+
// this will set debuggable to true in the .xml file
254+
target = "debug";
255+
File projectFolder = createProject();
256+
if (projectFolder != null) {
257+
File exportFolder = createExportFolder();
258+
Base.copyDir(projectFolder, exportFolder);
259+
return exportFolder;
248260
}
249-
250-
File exportFolder = createExportFolder();
251-
Base.copyDir(projectFolder, exportFolder);
252-
return exportFolder;
261+
return null;
253262
}
254263

255264

@@ -384,7 +393,7 @@ String getPathForAPK() {
384393
}
385394

386395

387-
private void writeBuildProps(final File file) {
396+
private void writeAntProps(final File file) {
388397
final PrintWriter writer = PApplet.createWriter(file);
389398
writer.println("application-package=" + getPackageName());
390399
writer.flush();
@@ -394,34 +403,46 @@ private void writeBuildProps(final File file) {
394403

395404
private void writeBuildXML(final File file, final String projectName) {
396405
final PrintWriter writer = PApplet.createWriter(file);
397-
writer.println("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
398-
399-
writer.println("<project name=\"" + projectName + "\" default=\"help\">");
400-
writer.println(" <property file=\"local.properties\"/>");
401-
writer.println(" <property file=\"build.properties\"/>");
402-
writer.println(" <property file=\"default.properties\"/>");
406+
writer.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
403407

404-
writer.println(" <path id=\"android.antlibs\">");
405-
writer.println(" <pathelement path=\"${sdk.dir}/tools/lib/anttasks.jar\" />");
406-
writer.println(" <pathelement path=\"${sdk.dir}/tools/lib/sdklib.jar\" />");
407-
writer.println(" <pathelement path=\"${sdk.dir}/tools/lib/androidprefs.jar\" />");
408-
writer.println(" <pathelement path=\"${sdk.dir}/tools/lib/apkbuilder.jar\" />");
409-
writer.println(" <pathelement path=\"${sdk.dir}/tools/lib/jarutils.jar\" />");
410-
writer.println(" </path>");
411408

412-
writer.println(" <taskdef name=\"setup\"");
413-
writer.println(" classname=\"com.android.ant.SetupTask\"");
414-
writer.println(" classpathref=\"android.antlibs\" />");
409+
410+
writer.println("<project name=\"" + projectName + "\" default=\"help\">");
411+
412+
writer.println(" <loadproperties srcFile=\"local.properties\" />");
413+
writer.println(" <property file=\"ant.properties\" />");
414+
writer.println(" <loadproperties srcFile=\"project.properties\" />");
415+
416+
writer.println(" <fail message=\"sdk.dir is missing. Make sure to generate local.properties using 'android update project'\" unless=\"sdk.dir\" />");
417+
418+
writer.println(" <!-- version-tag: 1 -->"); // should this be 'custom' instead of 1?
419+
writer.println(" <import file=\"${sdk.dir}/tools/ant/build.xml\" />");
415420

416-
writer.println(" <setup />");
421+
// writer.println(" <property file=\"local.properties\"/>");
422+
// writer.println(" <property file=\"build.properties\"/>");
423+
// writer.println(" <property file=\"default.properties\"/>");
424+
//
425+
// writer.println(" <path id=\"android.antlibs\">");
426+
// writer.println(" <pathelement path=\"${sdk.dir}/tools/lib/anttasks.jar\" />");
427+
// writer.println(" <pathelement path=\"${sdk.dir}/tools/lib/sdklib.jar\" />");
428+
// writer.println(" <pathelement path=\"${sdk.dir}/tools/lib/androidprefs.jar\" />");
429+
// writer.println(" <pathelement path=\"${sdk.dir}/tools/lib/apkbuilder.jar\" />");
430+
// writer.println(" <pathelement path=\"${sdk.dir}/tools/lib/jarutils.jar\" />");
431+
// writer.println(" </path>");
432+
//
433+
// writer.println(" <taskdef name=\"setup\"");
434+
// writer.println(" classname=\"com.android.ant.SetupTask\"");
435+
// writer.println(" classpathref=\"android.antlibs\" />");
436+
//
437+
// writer.println(" <setup />");
417438

418439
writer.println("</project>");
419440
writer.flush();
420441
writer.close();
421442
}
422443

423444

424-
private void writeDefaultProps(final File file) {
445+
private void writeProjectProps(final File file) {
425446
final PrintWriter writer = PApplet.createWriter(file);
426447
//writer.println("target=Google Inc.:Google APIs:" + sdkVersion);
427448
writer.println("target=" + sdkTarget);

app/src/processing/mode/android/AndroidToolbar.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ public void handlePressed(MouseEvent e, int sel) {
101101
break;
102102

103103
case EXPORT:
104-
if (shift) {
104+
if (!shift) {
105105
aeditor.handleExportPackage();
106106
} else {
107107
aeditor.handleExportProject();

core/todo.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
0202 core
2+
_ video problem with P3D
23

34

45
_ add inputPath() and outputPath() -> sketch folder or sd card

todo.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
0202 pde
22
X fix problem with serial not loading on macosx
3+
X fix problem with popup menus on the toolbar disappearing immediately (osx)
4+
X http://code.google.com/p/processing/issues/detail?id=846
5+
X http://code.google.com/p/processing/issues/detail?id=887
36

47

58
_ make note of when library is not available (serial) with error msg

0 commit comments

Comments
 (0)