Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio ORMLite Configuration File - Could Not Find Raw Directory

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

like image 683
Israel Lopez Avatar asked Jul 25 '13 16:07

Israel Lopez


5 Answers

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.

like image 137
Ben Groot Avatar answered Oct 31 '22 07:10

Ben Groot


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

like image 26
Lorenzo Barbagli Avatar answered Oct 31 '22 06:10

Lorenzo Barbagli


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.

like image 42
Razze Avatar answered Oct 31 '22 06:10

Razze


  1. Right click of DBConfigUtil file and run DBConfigUtil.main();
    1. Go to Edit configuration section.
    2. Make sure your working directory is somthing like this: /home/xyz/projects/xyz_project/app/src/main
    3. Changed the JRE to JDK1.8
    4. In the before launch section remove Make.
    5. Ok

and run again DBConfigUtil file.

Note: Make sure you have res/raw/ormlite_config.txt file

like image 34
Ganesh Katikar Avatar answered Oct 31 '22 05:10

Ganesh Katikar


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.

like image 1
Yasitha Waduge Avatar answered Oct 31 '22 05:10

Yasitha Waduge