Bon, maintenant, je suis vraiment coincé ici. Je ne sais pas quoi faire, où aller, ou QUOI que ce soit!
J'ai essayé de désinstaller, réinstaller, à la fois SDK Eclipse versions, en essayant de Google, mais nu-euh... Rien du tout!!!
Je PEUX utiliser mon application dans l'émulateur, mais je ne peux pas EXPORTER...
[2011-10-07 16:35:30 - Dex Loader] Impossible d'exécuter la dex: Plusieurs dex fichiers de définir l'icom/dreamhawk/kalori/DataBaseHelper;
c'est dataBaseHelper
package com.dreamhawk.kalori;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import android.content.Context;
import android.database.Cursor;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteException;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;
import android.widget.Toast;
public class DataBaseHelper extends SQLiteOpenHelper {
// The Android's default system path of your application database.
private static String DB_PATH = "/data/data/com.dreamhawk.kalori/databases/";
private static String DB_NAME = "livsmedel_db";
private DataBaseHelper myDBHelper;
private SQLiteDatabase myDb;
private final Context myContext;
private static final String DATABASE_TABLE = "Livsmedel";
public static String DB_FILEPATH = "/data/data/com.dreamhawk.kalori/databases/lifemedel_db";
public static final String KEY_TITLE = "Namn";
public static final String KEY_BODY = "Kcal";
public static final String KEY_ROWID = "_id";
private static final int DATABASE_VERSION = 2;
/**
* Constructor Takes and keeps a reference of the passed context in order to
* access to the application assets and resources.
*
* @param context
*/
public DataBaseHelper(Context context) {
super(context, DB_NAME, null, 1);
this.myContext = context;
// checking database and open it if exists
if (checkDataBase()) {
openDataBase();
} else {
try {
this.getReadableDatabase();
createDatabase();
this.close();
openDataBase();
} catch (IOException e) {
throw new Error("Error copying database");
}
Toast.makeText(context, "Livsmedelsdatabasen importerad",
Toast.LENGTH_LONG).show();
}
}
private boolean checkDataBase() {
SQLiteDatabase checkDB = null;
boolean exist = false;
try {
String dbPath = DB_PATH + DB_NAME;
checkDB = SQLiteDatabase.openDatabase(dbPath, null,
SQLiteDatabase.OPEN_READONLY);
} catch (SQLiteException e) {
Log.v("db log", "database does't exist");
}
if (checkDB != null) {
exist = true;
checkDB.close();
}
return exist;
}
@Override
public void onCreate(SQLiteDatabase db) {
// db.execSQL(DATABASE_CREATE);
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
Log.w("Kalori", "Upgrading database from version " + oldVersion + " to "
+ newVersion + ", which will destroy all old data");
db.execSQL("DROP TABLE IF EXISTS Livsmedel");
onCreate(db);
}
public DataBaseHelper open() throws SQLException {
myDBHelper = new DataBaseHelper(myContext);
myDb = myDBHelper.getWritableDatabase();
return this;
}
public void createDatabase() throws IOException {
InputStream assetsDB = myContext.getAssets().open("livsmedel_db");
// OutputStream dbOut = new FileOutputStream(DB_PATH);
String outFileName = DB_PATH + DB_NAME;
OutputStream dbOut = new FileOutputStream(outFileName);
Log.d("DH", "index=" + assetsDB);
byte[] buffer = new byte[1024];
int length;
while ((length = assetsDB.read(buffer)) > 0) {
dbOut.write(buffer, 0, length);
}
dbOut.flush();
dbOut.close();
assetsDB.close();
}
public Cursor fetchAllNotes() {
return myDb.query(DATABASE_TABLE, new String[] { KEY_ROWID, KEY_TITLE,
KEY_BODY }, null, null, null, null, null);
}
public void openDataBase() throws SQLException {
String dbPath = DB_PATH + DB_NAME;
myDb = SQLiteDatabase.openDatabase(dbPath, null,
SQLiteDatabase.OPEN_READWRITE);
}
}
Je soupçonne:
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
Mais je ne sais pas quoi faire... s'il vous Plaît aider !!! :'(