Randonee / BasisAndroid

Native Android application development with haxe
34 stars 7 forks source link

Class not found: android.view.View_OnKeyListener #6

Open ghost opened 10 years ago

ghost commented 10 years ago

I want to build the example project with the suggested command haxelib run basis build.basis android, but I get the following build errors:

haxe/src/example/MainView.hx:9: characters 7-38 : Class not found : android.view
.View_OnKeyListener
haxe/src/example/ApplicationMain.hx:3: lines 3-9 : Defined in this class
Error running: haxe build.hxml [build/android]

Where can I find the missing class to build this project?

Randonee commented 10 years ago

Have you installed from source or installed using "haxelib install basisAndroid"? To run the latest example you would need the latest code.

ghost commented 10 years ago

First I installed it via haxelib install basisAndroid but then I use the source from this git repo. Both are not working. The above errors I got with the sources from the git repo.

Randonee commented 10 years ago

did you use ant to install? "ant install"

You can't install from the git repo directly.

ghost commented 10 years ago

I grab the git repo with GitHub Windows application and copy only the template directory from the repo into C:\HaxeToolkit\haxe\lib\basisAndroid\0,1,0-alpha\template. I guess this is not the correct way, isn't it?

Can please explain the installation from the git repo in a little bit more detail?

Randonee commented 10 years ago
  1. Put the repo on your HD somewhere.
  2. From inside the repo directory run "ant install" from a command line.

This will build the needed binary, create the haxelib and install it to your haxelib dir. You should then be able to build the example app.

Instructions are also here: https://github.com/Randonee/Basis#building-from-source

ghost commented 10 years ago

Thanks. I get the following output, which is correct, I think.

C:\GitHub\BasisAndroid>ant install
Unable to locate tools.jar. Expected to find it in C:\Program Files\Java\jre6\li
b\tools.jar
Buildfile: C:\GitHub\BasisAndroid\build.xml

install:
     [exec] Library basisAndroid removed

buildHaxelib:
   [delete] Deleting directory C:\GitHub\BasisAndroid\bui
ld
    [mkdir] Created dir: C:\GitHub\BasisAndroid\build
    [mkdir] Created dir: C:\GitHub\BasisAndroid\build\bas
isAndroid
    [mkdir] Created dir: C:\GitHub\BasisAndroid\build\bas
isAndroid\0,0,3-alpha
    [mkdir] Created dir: C:\GitHub\BasisAndroid\build\bas
isAndroid\0,0,3-alpha\bin
    [mkdir] Created dir: C:\GitHub\BasisAndroid\build\bas
isAndroid\0,0,3-alpha\template
     [copy] Copying 1 file to C:\GitHub\BasisAndroid\buil
d\basisAndroid\0,0,3-alpha
     [copy] Copying 10 files to C:\GitHub\BasisAndroid\bu
ild\basisAndroid\0,0,3-alpha\template
     [copy] Copying 1 file to C:\GitHub\BasisAndroid\buil
d\basisAndroid\0,0,3-alpha
     [copy] Copying 1 file to C:\GitHub\BasisAndroid\buil
d\basisAndroid\0,0,3-alpha
      [zip] Building zip: C:\GitHub\BasisAndroid\build\ba
sisAndroid.zip
     [exec]   Created android/
     [exec]   Created android/app/
     [exec]   Created bin/
     [exec]   Created template/
     [exec]   Created template/haxe/
     [exec]   Created template/haxe/src/
     [exec]   Created template/haxe/src/r/
     [exec]   Created template/libs/
     [exec]   Created template/libs/armeabi/
     [exec]   Created template/src/
     [exec]   Created template/src/basis/
     [exec]   Install android/app/MainActivity.hx
     [exec]   Install haxelib.json
     [exec]   Install run.n
     [exec]   Install template/AndroidManifest.xml
     [exec]   Install template/BasisActivity.java
     [exec]   Install template/build.xml
     [exec]   Install template/default.properties
     [exec]   Install template/haxe/src/r/Id.hx
     [exec]   Install template/haxe/src/r/Layout.hx
     [exec]   Install template/haxe/src/r/RMacros.hx
     [exec]   Install template/haxe/src/r/RString.hx
     [exec]   Install template/libs/armeabi/readme.txt
     [exec]   Install template/src/basis/MainActivity.java
     [exec]   Current version is now 0.1.0-alpha
     [exec] Done

BUILD SUCCESSFUL
Total time: 2 seconds

When I run the command haxelib run basis build.basis android again, I get the same error message as described in my first post.

Randonee commented 10 years ago

This is because it is not finding android.jar probably because the correct API version is not installed. The example is set to use android API version 16. Two options:

  1. Change the api version in the example build file (build.basis) by editing this element: androidAPIVersion value="16"
  2. Install android api version 16