mirahndroid icon indicating copy to clipboard operation
mirahndroid copied to clipboard

Class 'android.app.Activity' not found (bad classpath?)

Open telent opened this issue 15 years ago • 2 comments

"mirahndroid" appears to generate a project that "ant debug" won't build unless I set $CLASSPATH explicitly to include android.jar

:; mirahndroid create -a ActivityUnfound -n unfound -k com.example.unfound -p unfound -t 7 Project generated! Edit your starter activity at /home/dan/for_jackoway/unfound/src/com/example/unfound/ActivityUnfound.mirah :; cd unfound/ :; ant debug [...]

compile: [exec] Inference Error: [exec] ./com/example/unfound/ActivityUnfound.mirah:8: Class 'android.app.Activity' not found. [exec] class ActivityUnfound < Activity

See https://gist.github.com/701108 for a build transcript

telent avatar Nov 17 '10 15:11 telent

It may be related to the fact that you're saying -t 7 instead of -t android-7

For me, if I do -t 7, android create project complains:

Error: Target id is not valid. Use 'android list targets' to get the target ids.

mirahndroid uses the target you pass to add a line default.properties. It changes default.properties from something like this: target=android-7 to something like this: target=android-7 target-version=android-7 which magically makes the error you're getting go away. But if you can get it to work only passing "7", the way my code is written, it'll say target-version=7 instead, which probably doesn't work).

If it is actually possible to say 7 instead of android-7, I should make the code smarter.

Take a look at your default.properties. If it looks like target=android-7 target-version=7 change target-version to android-7 and see what happens.

jackowayed avatar Nov 17 '10 21:11 jackowayed

That does indeed seem to fix it, though at the cost of deepening my confusion about target ids.

I have :; android list | grep '^id' id: 1 or "android-5" id: 2 or "android-6" id: 3 or "Google Inc.:Google APIs:6" id: 4 or "android-7" id: 5 or "Google Inc.:Google APIs:7" id: 6 or "android-8" id: 7 or "Google Inc.:Google APIs:8"

and I was under the impression that I need to use one of the 'Google APIs' ids, hence 5 or 7, if I want to use the maps and other google apps goodies. For a java project with the regualr android scripts I'd do

:; android create project -a ActivityUnfound -n unfound -k com.example.unfound -p unfound1 -t 7

and that gets me :; grep -v '#' unfound1/default.properties target=Google Inc.:Google APIs:8

telent avatar Nov 17 '10 22:11 telent