I’ve recently set everything thing up, all went fine except I had to run “android update project” to get things rolling.
However currently none of the examples that use data seem to work - e.g. imageExample and fontExample.
The camera works fine, regular graphics work fine.
I have no idea where to start looking for a fix for this. Any ideas? I’m using 0.071
also to debug it, add a ofLogNotice() << ofToDataPath(""); to your setup and check the logcat to see which path it’s pointing too. and you can see if the files are there using any file explorer and checking the sdcard, the data should be in /sdcard/cc.openframeworks.appName/
OK thanks, I haven’t tried develop yet. Basically it has to be some path issue I think, however no errors were produced in the process so it was rather mysterious.
Hi Arturo, is this still true? I’m trying to run the ofxPd addon example on android and after a bit of work have it launching successfully but erroring out during creation of the directory on the sdcard. The pd patch I’d like to run won’t load because copying it over during installation fails as below:
the problem should be with the permission, we removed it by accident for 0.7.0 i’ve also found some days ago a problem with how the data path is being detected for some devices. in OFAndroid you need to change getRealExternalStorage to:
public static String getRealExternalStorageDirectory()
{
// Standard way to get the external storage directory
String externalPath = Environment.getExternalStorageDirectory().getAbsolutePath();
File SDCardDir = new File(externalPath);
if(SDCardDir.exists() && SDCardDir.canWrite()) {
return externalPath;
}
// This checks if any of the directories from mExternalStorageDirectories exist, if it does, it uses that one instead
for(int i = 0; i < mExternalStorageDirectories.length; i++)
{
//Log.i("OF", "Checking: " + mExternalStorageDirectories[i]);
SDCardDir = new File(mExternalStorageDirectories[i]);
if(SDCardDir.exists() && SDCardDir.canWrite()) {
externalPath = mExternalStorageDirectories[i]; // Found writable location
break;
}
}
Log.i("OF", "Using storage location: " + externalPath);
return externalPath;
}
Thanks again Arturo, I got past this error now on my Galaxy Nexus (only) and can see all my data via adb shell!
Unfortunately the emulator is still not working. I read a lot about adding command line arguments “-sdcard” to the emulator launch command (or invoke emu directly it from the terminal) to get around the /mnt/sdcard showing d—rwxrwx (as we see in the DDMS explorer view) For now, I focus on a real device
Back to debugging my pd-patch loading and the sound of silence!! This ofxPd addon test on Android is proving to be quite involved.
Arturo, do you have any hints on debugging the NDK (stepping through it in gdb/eclipse) or have other pearls of wisdom?
Hi guys! I’ve just encountered a problem related to data on Android device: my app runs without trouble with oF0.8.0, and I can see all datas in the right folder on the Android device.
If I try to use the master from github instead everything compiles fine, but no data is seen! The app obviously crashes, then I check on the device and the data folder is empty; I’ve already checked the path in the log from the app and it’s correct…
do you have some ideas/suggestions, please? is there something different in the actual master that I have to know about data management?
I’m on a real device (a Samsung Galaxy Tab 2);
I’ve tried also to run some examples (perfectly working with the stable 0.8.0) with the latest version of oF taken from github, and the same thing happens: apps with data always crash, because data folder on the device is empty!
Did you try to create the directory manually by a file browser before launching your app? If so what happens? Can you create it? And can the app be launched then?
Another thing, altough I don’t believe that it is your problem; are you sure the name of your xxxresources.zip file contains only lower case letters? I remember Android doesn’t accept file names with upper cases under /res folder.
ps. You can try also the directory name with only lower case letters.
I tried manually copying the data folder (generated on the device with a 0.8.0-equivalent app compiled), but with no luck; also tried to lower-case everything… still same errors…
Then I tried all the android examples included with the master, and I can confirm that only the ones without data worked; any of the other can’t find resources (and their data folders are actually empty) and gave me the usual errors in the log cat (“couldn’t find file…” etc…)
it’s really strange… oF0.8.0 worked out of the box for me, without any trouble… but I want to switch to the github master branch in order to make the camera working (and also to take advantage from some other useful fixes…)
can you post the output of logcat? i did some changes to the way we find out the app’s data folder, it’s working for me but perhaps it’s problematic in other devices
ok! I just ran “androidImageExample” on my Galaxy Tab 2.0 (Android 4.2.1); the app starts but displays no image (data folder on the device is empty) here’s the output from the logcat:
can you pull again from master? seems like the app name that should been converted to lower case to get the name of the resources file is not being converted properly, i’ve done a small change to see if that fixes it. if it still doesn’t work please post the output from logcat again
simply copy-pasted the 3 lines you’ve modified in OFAndroid.java and now the examples work!
I’ve just tried 4 different examples that use data and no one gave me problems! the data folder is now on the device in the right position!