Following notes from the previous question: Android Studio run configuration for ORMLite config generation
I was able to get my configuration to run this one class, but it is still failing with
Could not find raw directory
This is my source
package com.ilopez.android.machinesounds;
import com.j256.ormlite.android.apptools.OrmLiteConfigUtil;
import java.io.File;
import java.io.IOException;
import java.sql.SQLException;
/**
* Created by User on 7/25/13.
*/
public class DatabaseConfigUtil extends OrmLiteConfigUtil {
private static final Class<?>[] classes = new Class[]{
RecordedSound.class,
};
public static void main(String[] args) throws IOException, SQLException {
writeConfigFile(new File("G:\\MachineSoundsProject\\MachineSounds\\src\\main\\res\\raw\\ormlite_config.txt"), classes );
}
}
My platform is windows, and I cant really figure out why it keeps failing with "could not find raw directory".
This is the command my android studio runs:
"C:\Program Files\Java\jdk1.6.0_37\bin\java" -Didea.launcher.port=7544 "-Didea.launcher.bin.path=C:\Program Files (x86)\Android\android-studio\bin" -Dfile.encoding=UTF-8 -classpath "C:\Program Files (x86)\Android\android-studio\sdk\platforms\android-17\android.jar;C:\Program Files (x86)\Android\android-studio\sdk\platforms\android-17\data\res;C:\Program Files (x86)\Android\android-studio\sdk\tools\support\annotations.jar;C:\local\Dropbox\git\MachineSoundsProject\MachineSounds\build\classes\debug;C:\Program Files (x86)\Android\android-studio\sdk\extras\android\m2repository\com\android\support\support-v4\13.0.0\support-v4-13.0.0.jar;C:\local\Dropbox\git\MachineSoundsProject\MachineSounds\libs\ormlite-android-4.45.jar;C:\local\Dropbox\git\MachineSoundsProject\MachineSounds\libs\ormlite-core-4.45.jar;C:\local\Dropbox\git\MachineSoundsProject\MachineSounds\libs\ormlite-jdbc-4.45.jar;C:\Program Files (x86)\Android\android-studio\lib\idea_rt.jar" com.intellij.rt.execution.application.AppMain com.ilopez.android.machinesounds.DatabaseConfigUtil
I'm using version 4.45 of ORMLite
I got the same error. I've forgot to add the "new File()" construction. After I've added that it still gave the same message. But then when I've rebuilt the project it was working suddenly.
To summarize what I did (MAC OSX user): - make sure you've added both ormlite-android and ormlite-core jar files to the libs dir - right click to add them as project library - copy the OrmLiteConfigUtil instructions from the ormlite instructions - make sure you use the full path and use the File class - add the raw dir in the res tree - add an empty ormlite_config.txt - create the build config
Apparently you need to do a Rebuild after every change to let them have effect.
You can use Android Studio with no problem, but make sure in edit configurations to select standard JDK and (important!) to modify "Working directory" by selecting the "main" folder of your android project
It should be something like: /your_workspace/your_project/app/src/main
If you try to create it in Android Studio its trying to find the folder in the top most directory (where .idea is for e.g.) So if you create a directory res and within that raw, the util will be able to create the file.
and run again DBConfigUtil file.
Note: Make sure you have res/raw/ormlite_config.txt file
You get this error, If you haven't created raw folder inside res folder already. Just create raw folder manually inside res folder and try. This happens me in eclispse IDE in MAC.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With