From: Arno P. <ar...@pu...> - 2009-12-15 13:09:08
|
Alex, I have these kind of problems all the time (although I never managed to crash my whole machine). The first step in finding the problem is to identify the precise location where the program crashes. The best way to do this is by setting breakpoints and to single step with Xcode. Tedious, but if you don't know where the program crashes it is virtually impossible to find out what is going on. Since your whole machine crashes, you might want to run and debug your program on the device. At least you don't have to reboot your Mac all the time. :) Arno On 12/15/09 2:03 PM, Dr. Alexander K. Seewald wrote: > There is something very strange going on. I get a major error when > initializing a FileInputStream with any resource path (i.e. path > obtained by ... > String fileName = getFileNamePath(findResourceNameById(resourceId)); > String filePath = NSBundle.mainBundle().pathForResource(fileName,"xml"); > - I've tested with activity.xml = my layout file and one raw > resource) > and then instantiating a new FileInputStream object. > > FileInputStream fis = new FileInputStream(filePath); > > If filePath does not exist, it gives a FileNotFound exception. If it > does exist (e.g. the activity.xml is obviously read during startup), > there is a major crash of the whole MacOS - not only the iPhone > emulator. > > I've noted that my icon is not shown as well, so perhaps there is a > problem with resources in general. However, my layout xml is pretty > basic: > > <?xml version="1.0" encoding="utf-8"?> > <LinearLayout > xmlns:android="http://schemas.android.com/apk/res/android" > android:layout_width="fill_parent" > android:layout_height="fill_parent" > android:orientation="vertical"> > > <TextView android:id="@+id/result" > android:layout_width="wrap_content" > android:layout_height="wrap_content"> > </TextView> > > <Button android:id="@+id/livetest" > android:layout_width="wrap_content" > android:layout_height="wrap_content" > android:text="@string/livetest" > ></Button> > > <Button android:id="@+id/back" > android:layout_width="wrap_content" > android:layout_height="wrap_content" > android:text="@string/back" > ></Button> > > <Button android:id="@+id/validate" > android:layout_width="wrap_content" > android:layout_height="wrap_content" > android:text="@string/validate" > android:enabled="true" > ></Button> > </LinearLayout> > > ... as well as the AndroidManifest.xml: > > <?xml version="1.0" encoding="utf-8"?> > <manifest xmlns:android="http://schemas.android.com/apk/res/android" > package="com.SeewaldSolutions.DanceMusicRecognizer" > android:versionCode="1" > android:versionName="1.0"> > <uses-sdk android:minSdkVersion="3" /> > <uses-permission > android:name="android.permission.RECORD_AUDIO"></uses-permission> > <uses-permission > android:name="android.permission.INTERNET"></uses-permission> > <application android:label="@string/dancing_guide_app" > android:icon="@drawable/launcher"> > <activity android:name="DanceMusicRecognizerActivity" > android:icon="@drawable/launcher" > android:configChanges="orientation"> > <intent-filter> > <action android:name="android.intent.action.MAIN" /> > <category > android:name="android.intent.category.LAUNCHER" /> > </intent-filter> > </activity> > </application> > </manifest> > > > I compile using ... > javac > android_src/src/com/SeewaldSolutions/DanceMusicRecognizer/*.java > android_src/gen/com/SeewaldSolutions/DanceMusicRecognizer/R.java -d > android_src_build -cp > xmlvm/dist/lib/objc-compat.jar:xmlvm/dist/lib/android-compat.jar > > ... and use xmlvm like this ... > > java -jar xmlvm/dist/xmlvm.jar --in=android_src_build > --out=DanceMusicRecognizer --target=android-on-iphone > --iphone-app=DanceMusicRecognizer --resource=android_src/res/layout > --resource=android_src/res/raw --resource=android_src/res/drawable > --resource=android_src/AndroidManifest.xml > > activity.xml (from layout directory) and the icons are copied to the > resource directory in target, but I still get @string/back and so on > as button text. I always got a crash when trying to access images as > well, and the icon does not work. Is there anything I am doing > wrong? > > Best, > Alex |