更改 Android Eclipse 设置以忽略错误
Change Android Eclipse settings to ignore error
我对一个 apk 文件进行了逆向工程,并在 java 文件中编辑了一些内容,这给了我很多错误但在此之前,我已经测试了原始的 java 文件和资源我在没有进行任何编辑的情况下对 apk 进行逆向工程,但它给我的错误与我在编辑 java 文件和资源时遇到的错误相同,是否可以忽略 eclipse 中的所有错误并导出 apk 进行测试或没有错误的东西,
这是一个错误示例:
public class DataHeper
{
public SQLiteDatabase database = null;
public File databaseFile;
public String databaseName = "data.sqlite";
public String databasePath = "";
Context mContext;
public DataHeper(Context paramContext)
{
this.mContext = paramContext;
this.databasePath = ("data/data/" + paramContext.getPackageName() + "/data.sqlite");
this.databaseFile = new File(this.databasePath);
if (!this.databaseFile.exists());
try
{
deployDataBase(this.databaseName, this.databasePath);
return;
}
catch (IOException localIOException)
{
localIOException.printStackTrace();
}
}
private void deployDataBase(String paramString1, String paramString2)
throws IOException
{
InputStream localInputStream = this.mContext.getAssets().open(paramString1);
FileOutputStream localFileOutputStream = new FileOutputStream(paramString2);
byte[] arrayOfByte = new byte[1024];
while (true)
{
int i = localInputStream.read(arrayOfByte);
if (i <= 0)
{
localFileOutputStream.flush();
localFileOutputStream.close();
localInputStream.close();
return;
}
localFileOutputStream.write(arrayOfByte, 0, i);
}
}
public boolean AddFavourites(String paramString)
{
String str = "UPDATE quotes SET is_favourist = 1 WHERE _id = " + paramString + ";";
try
{
this.database = SQLiteDatabase.openDatabase(this.databasePath, null, 0);
this.database.execSQL(str);
this.database.close();
return true;
}
catch (Exception localException)
{
}
return false;
}
public boolean DeleteAllFavourites()
{
try
{
this.database = SQLiteDatabase.openDatabase(this.databasePath, null, 0);
this.database.execSQL("UPDATE quotes SET is_favourist = 0 WHERE is_favourist = 1 ;");
this.database.close();
return true;
}
catch (Exception localException)
{
}
return false;
}
public boolean DeleteFavourites(String paramString)
{
String str = "UPDATE quotes SET is_favourist = 0 WHERE _id = " + paramString + ";";
try
{
this.database = SQLiteDatabase.openDatabase(this.databasePath, null, 0);
this.database.execSQL(str);
this.database.close();
return true;
}
catch (Exception localException)
{
}
return false;
}
public boolean SaveQuoteOfDay(int paramInt, String paramString)
{
Date localDate = new Date();
this.database = SQLiteDatabase.openDatabase(this.databasePath, null, 0);
Cursor localCursor = this.database.rawQuery("select * from qod LIMIT 1;", null);
if ((localCursor == null) || (localCursor.getCount() == 0))
{
String str = "INSERT INTO qod (quote_id,changed,body) VALUES (" + paramInt + "," + localDate.getTime() + ",\"" + paramString + "\") ;";
this.database.execSQL(str);
}
try
{
while (true)
{
localCursor.close();
this.database.close();
return true;
new StringBuilder("UPDATE qod SET quote_id = ").append(paramInt).append(",changed = ").append(localDate.getTime()).append(",body = \"\"").append(paramString).append("\"\" ;").toString();
StringBuilder localStringBuilder = new StringBuilder();
localStringBuilder.append("UPDATE qod SET ").append(" quote_id = ").append(paramInt).append(",changed = ").append(localDate.getTime()).append(",body = '").append(paramString.replaceAll("'", "''")).append("' ;");
this.database.execSQL(localStringBuilder.toString());
}
}
catch (Exception localException)
{
localCursor.close();
this.database.close();
return false;
}
finally
{
localCursor.close();
this.database.close();
}
}
public Quote getNextQuote(int paramInt)
{
this.database = SQLiteDatabase.openDatabase(this.databasePath, null, 0);
String str = "select quotes._id,quotes.body,quotes.is_favourist from quotes WHERE quotes._id >" + paramInt + " LIMIT 1;";
WriteLog.d("ThangTB", "next quote -->query= " + str);
Cursor localCursor = this.database.rawQuery(str, null);
if ((localCursor == null) || (localCursor.getCount() == 0))
{
localCursor.close();
this.database.close();
return null;
}
localCursor.moveToFirst();
Quote localQuote;
do
localQuote = new Quote(Integer.parseInt(localCursor.getString(0)), localCursor.getString(1), Integer.parseInt(localCursor.getString(2))); while (localCursor.moveToNext());
localCursor.close();
this.database.close();
return localQuote;
}
public Quote getPreQuote(int paramInt)
{
Quote localQuote = null;
while (true)
{
if (localQuote != null)
return localQuote;
int i = paramInt - 1;
this.database = SQLiteDatabase.openDatabase(this.databasePath, null, 0);
String str = "select quotes._id,quotes.body,quotes.is_favourist from quotes WHERE quotes._id = " + i + ";";
WriteLog.d("ThangTB", "pre quote -->query= " + str);
Cursor localCursor = this.database.rawQuery(str, null);
if ((localCursor == null) || (localCursor.getCount() == 0))
{
localCursor.close();
this.database.close();
localQuote = null;
}
else
{
localCursor.moveToFirst();
do
localQuote = new Quote(Integer.parseInt(localCursor.getString(0)), localCursor.getString(1), Integer.parseInt(localCursor.getString(2)));
while (localCursor.moveToNext());
localCursor.close();
this.database.close();
}
}
}
public QOD getQOD()
{
this.database = SQLiteDatabase.openDatabase(this.databasePath, null, 0);
Cursor localCursor = this.database.rawQuery("select * from qod LIMIT 1;", null);
if ((localCursor == null) || (localCursor.getCount() == 0))
{
localCursor.close();
this.database.close();
return null;
}
localCursor.moveToFirst();
QOD localQOD;
do
localQOD = new QOD(Integer.parseInt(localCursor.getString(0)), Long.valueOf(Long.parseLong(localCursor.getString(1))), localCursor.getString(2));
while (localCursor.moveToNext());
localCursor.close();
this.database.close();
return localQOD;
}
public ArrayList<Quote> getQuoteByFav()
{
ArrayList localArrayList = new ArrayList();
this.database = SQLiteDatabase.openDatabase(this.databasePath, null, 0);
Cursor localCursor = this.database.rawQuery("select quotes._id,quotes.body,quotes.is_favourist from quotes WHERE is_favourist = 1 GROUP BY quotes._id Order by body asc;", null);
if ((localCursor == null) || (localCursor.getCount() == 0))
{
localCursor.close();
this.database.close();
return localArrayList;
}
localCursor.moveToFirst();
do
localArrayList.add(new Quote(Integer.parseInt(localCursor.getString(0)), localCursor.getString(1), Integer.parseInt(localCursor.getString(2))));
while (localCursor.moveToNext());
localCursor.close();
this.database.close();
WriteLog.d("ThangTB", "query: " + "select quotes._id,quotes.body,quotes.is_favourist from quotes WHERE is_favourist = 1 GROUP BY quotes._id Order by body asc;");
return localArrayList;
}
public Quote getQuoteById(int paramInt)
{
this.database = SQLiteDatabase.openDatabase(this.databasePath, null, 0);
String str = "select quotes._id,quotes.body,quotes.is_favourist from quotes WHERE quotes._id = " + paramInt + ";";
WriteLog.d("ThangTB", "pre quote -->query= " + str);
Cursor localCursor = this.database.rawQuery(str, null);
if ((localCursor == null) || (localCursor.getCount() == 0))
{
localCursor.close();
this.database.close();
return null;
}
localCursor.moveToFirst();
Quote localQuote;
do
localQuote = new Quote(Integer.parseInt(localCursor.getString(0)), localCursor.getString(1), Integer.parseInt(localCursor.getString(2)));
while (localCursor.moveToNext());
localCursor.close();
this.database.close();
return localQuote;
}
public ArrayList<Quote> getQuoteByLimit(int paramInt1, int paramInt2, String paramString)
{
ArrayList localArrayList = new ArrayList();
this.database = SQLiteDatabase.openDatabase(this.databasePath, null, 0);
if (paramString != null);
Cursor localCursor;
for (String str = "select quotes._id,quotes.body,quotes.is_favourist FROM quotes GROUP BY quotes._id ORDER BY body " + paramString + " Limit " + (paramInt1 - 1) + "," + paramInt2 + ";"; ; str = "select quotes._id,quotes.body,quotes.is_favourist FROM quotes GROUP BY quotes._id Limit " + (paramInt1 - 1) + "," + paramInt2 + ";")
{
WriteLog.d("ThangTB", "query: " + str);
localCursor = this.database.rawQuery(str, null);
if ((localCursor != null) && (localCursor.getCount() != 0))
break;
localCursor.close();
this.database.close();
return localArrayList;
}
localCursor.moveToFirst();
do
localArrayList.add(new Quote(Integer.parseInt(localCursor.getString(0)), localCursor.getString(1), Integer.parseInt(localCursor.getString(2))));
while (localCursor.moveToNext());
localCursor.close();
this.database.close();
return localArrayList;
}
public Quote getQuoteRandom(int paramInt)
{
Quote localQuote = null;
this.database = SQLiteDatabase.openDatabase(this.databasePath, null, 0);
while (true)
{
if (localQuote != null)
{
this.database.close();
WriteLog.d("ThangTB", "random quote = " + localQuote.getBody());
return localQuote;
}
int i = new Random().nextInt(paramInt + 1);
String str = "select quotes._id,quotes.body,quotes.is_favourist from quotes WHERE quotes._id =" + String.valueOf(i) + ";";
Cursor localCursor = this.database.rawQuery(str, null);
if ((localCursor == null) || (localCursor.getCount() == 0))
{
localCursor.close();
localQuote = null;
}
else
{
localCursor.moveToFirst();
do
localQuote = new Quote(Integer.parseInt(localCursor.getString(0)), localCursor.getString(1), Integer.parseInt(localCursor.getString(2)));
while (localCursor.moveToNext());
localCursor.close();
}
}
}
public ArrayList<Quote> getSearchQuoteByString(String paramString)
{
ArrayList localArrayList = new ArrayList();
this.database = SQLiteDatabase.openDatabase(this.databasePath, null, 0);
String str = "select quotes._id,quotes.body,quotes.is_favourist from quotes WHERE quotes.body like '%" + paramString + "%'" + " GROUP BY quotes._id " + " Order by body asc;";
Cursor localCursor = this.database.rawQuery(str, null);
if ((localCursor == null) || (localCursor.getCount() == 0))
{
localCursor.close();
this.database.close();
return localArrayList;
}
localCursor.moveToFirst();
do
localArrayList.add(new Quote(Integer.parseInt(localCursor.getString(0)), localCursor.getString(1), Integer.parseInt(localCursor.getString(2))));
while (localCursor.moveToNext());
localCursor.close();
this.database.close();
WriteLog.d("ThangTB", "query: " + str);
return localArrayList;
}
public int getTotalQuotesNoFilter()
{
int i = 0;
this.database = SQLiteDatabase.openDatabase(this.databasePath, null, 0);
WriteLog.d("ThangTB", "query: " + "SELECT count(quotes._id) FROM quotes;");
try
{
Cursor localCursor = this.database.rawQuery("SELECT count(quotes._id) FROM quotes;", null);
i = 0;
if (localCursor != null)
{
localCursor.moveToFirst();
i = localCursor.getInt(0);
}
if (localCursor != null)
localCursor.close();
return i;
}
catch (Exception localException)
{
return i;
}
finally
{
this.database.close();
}
}
}
这里我有一个错误告诉我:
Unreachable code
in: new StringBuilder("UPDATE qod SET quote_id = ").append(paramInt).append(",changed = ").append(localDate.getTime()).append(",body = \"\"").append(paramString).append("\"\" ;").toString();
我在很多文件中都有这个错误
提前致谢
因为你在上面的行中有 return true,这使得它退出 while 循环,这就是它无法访问的原因。
然后 Java 7 在 android 中不能很好地工作。
这是关于此的话题:
计算器。com/questions/9098684/
获取最新的 JDK 它应该可以正常工作!
我对一个 apk 文件进行了逆向工程,并在 java 文件中编辑了一些内容,这给了我很多错误但在此之前,我已经测试了原始的 java 文件和资源我在没有进行任何编辑的情况下对 apk 进行逆向工程,但它给我的错误与我在编辑 java 文件和资源时遇到的错误相同,是否可以忽略 eclipse 中的所有错误并导出 apk 进行测试或没有错误的东西, 这是一个错误示例:
public class DataHeper
{
public SQLiteDatabase database = null;
public File databaseFile;
public String databaseName = "data.sqlite";
public String databasePath = "";
Context mContext;
public DataHeper(Context paramContext)
{
this.mContext = paramContext;
this.databasePath = ("data/data/" + paramContext.getPackageName() + "/data.sqlite");
this.databaseFile = new File(this.databasePath);
if (!this.databaseFile.exists());
try
{
deployDataBase(this.databaseName, this.databasePath);
return;
}
catch (IOException localIOException)
{
localIOException.printStackTrace();
}
}
private void deployDataBase(String paramString1, String paramString2)
throws IOException
{
InputStream localInputStream = this.mContext.getAssets().open(paramString1);
FileOutputStream localFileOutputStream = new FileOutputStream(paramString2);
byte[] arrayOfByte = new byte[1024];
while (true)
{
int i = localInputStream.read(arrayOfByte);
if (i <= 0)
{
localFileOutputStream.flush();
localFileOutputStream.close();
localInputStream.close();
return;
}
localFileOutputStream.write(arrayOfByte, 0, i);
}
}
public boolean AddFavourites(String paramString)
{
String str = "UPDATE quotes SET is_favourist = 1 WHERE _id = " + paramString + ";";
try
{
this.database = SQLiteDatabase.openDatabase(this.databasePath, null, 0);
this.database.execSQL(str);
this.database.close();
return true;
}
catch (Exception localException)
{
}
return false;
}
public boolean DeleteAllFavourites()
{
try
{
this.database = SQLiteDatabase.openDatabase(this.databasePath, null, 0);
this.database.execSQL("UPDATE quotes SET is_favourist = 0 WHERE is_favourist = 1 ;");
this.database.close();
return true;
}
catch (Exception localException)
{
}
return false;
}
public boolean DeleteFavourites(String paramString)
{
String str = "UPDATE quotes SET is_favourist = 0 WHERE _id = " + paramString + ";";
try
{
this.database = SQLiteDatabase.openDatabase(this.databasePath, null, 0);
this.database.execSQL(str);
this.database.close();
return true;
}
catch (Exception localException)
{
}
return false;
}
public boolean SaveQuoteOfDay(int paramInt, String paramString)
{
Date localDate = new Date();
this.database = SQLiteDatabase.openDatabase(this.databasePath, null, 0);
Cursor localCursor = this.database.rawQuery("select * from qod LIMIT 1;", null);
if ((localCursor == null) || (localCursor.getCount() == 0))
{
String str = "INSERT INTO qod (quote_id,changed,body) VALUES (" + paramInt + "," + localDate.getTime() + ",\"" + paramString + "\") ;";
this.database.execSQL(str);
}
try
{
while (true)
{
localCursor.close();
this.database.close();
return true;
new StringBuilder("UPDATE qod SET quote_id = ").append(paramInt).append(",changed = ").append(localDate.getTime()).append(",body = \"\"").append(paramString).append("\"\" ;").toString();
StringBuilder localStringBuilder = new StringBuilder();
localStringBuilder.append("UPDATE qod SET ").append(" quote_id = ").append(paramInt).append(",changed = ").append(localDate.getTime()).append(",body = '").append(paramString.replaceAll("'", "''")).append("' ;");
this.database.execSQL(localStringBuilder.toString());
}
}
catch (Exception localException)
{
localCursor.close();
this.database.close();
return false;
}
finally
{
localCursor.close();
this.database.close();
}
}
public Quote getNextQuote(int paramInt)
{
this.database = SQLiteDatabase.openDatabase(this.databasePath, null, 0);
String str = "select quotes._id,quotes.body,quotes.is_favourist from quotes WHERE quotes._id >" + paramInt + " LIMIT 1;";
WriteLog.d("ThangTB", "next quote -->query= " + str);
Cursor localCursor = this.database.rawQuery(str, null);
if ((localCursor == null) || (localCursor.getCount() == 0))
{
localCursor.close();
this.database.close();
return null;
}
localCursor.moveToFirst();
Quote localQuote;
do
localQuote = new Quote(Integer.parseInt(localCursor.getString(0)), localCursor.getString(1), Integer.parseInt(localCursor.getString(2))); while (localCursor.moveToNext());
localCursor.close();
this.database.close();
return localQuote;
}
public Quote getPreQuote(int paramInt)
{
Quote localQuote = null;
while (true)
{
if (localQuote != null)
return localQuote;
int i = paramInt - 1;
this.database = SQLiteDatabase.openDatabase(this.databasePath, null, 0);
String str = "select quotes._id,quotes.body,quotes.is_favourist from quotes WHERE quotes._id = " + i + ";";
WriteLog.d("ThangTB", "pre quote -->query= " + str);
Cursor localCursor = this.database.rawQuery(str, null);
if ((localCursor == null) || (localCursor.getCount() == 0))
{
localCursor.close();
this.database.close();
localQuote = null;
}
else
{
localCursor.moveToFirst();
do
localQuote = new Quote(Integer.parseInt(localCursor.getString(0)), localCursor.getString(1), Integer.parseInt(localCursor.getString(2)));
while (localCursor.moveToNext());
localCursor.close();
this.database.close();
}
}
}
public QOD getQOD()
{
this.database = SQLiteDatabase.openDatabase(this.databasePath, null, 0);
Cursor localCursor = this.database.rawQuery("select * from qod LIMIT 1;", null);
if ((localCursor == null) || (localCursor.getCount() == 0))
{
localCursor.close();
this.database.close();
return null;
}
localCursor.moveToFirst();
QOD localQOD;
do
localQOD = new QOD(Integer.parseInt(localCursor.getString(0)), Long.valueOf(Long.parseLong(localCursor.getString(1))), localCursor.getString(2));
while (localCursor.moveToNext());
localCursor.close();
this.database.close();
return localQOD;
}
public ArrayList<Quote> getQuoteByFav()
{
ArrayList localArrayList = new ArrayList();
this.database = SQLiteDatabase.openDatabase(this.databasePath, null, 0);
Cursor localCursor = this.database.rawQuery("select quotes._id,quotes.body,quotes.is_favourist from quotes WHERE is_favourist = 1 GROUP BY quotes._id Order by body asc;", null);
if ((localCursor == null) || (localCursor.getCount() == 0))
{
localCursor.close();
this.database.close();
return localArrayList;
}
localCursor.moveToFirst();
do
localArrayList.add(new Quote(Integer.parseInt(localCursor.getString(0)), localCursor.getString(1), Integer.parseInt(localCursor.getString(2))));
while (localCursor.moveToNext());
localCursor.close();
this.database.close();
WriteLog.d("ThangTB", "query: " + "select quotes._id,quotes.body,quotes.is_favourist from quotes WHERE is_favourist = 1 GROUP BY quotes._id Order by body asc;");
return localArrayList;
}
public Quote getQuoteById(int paramInt)
{
this.database = SQLiteDatabase.openDatabase(this.databasePath, null, 0);
String str = "select quotes._id,quotes.body,quotes.is_favourist from quotes WHERE quotes._id = " + paramInt + ";";
WriteLog.d("ThangTB", "pre quote -->query= " + str);
Cursor localCursor = this.database.rawQuery(str, null);
if ((localCursor == null) || (localCursor.getCount() == 0))
{
localCursor.close();
this.database.close();
return null;
}
localCursor.moveToFirst();
Quote localQuote;
do
localQuote = new Quote(Integer.parseInt(localCursor.getString(0)), localCursor.getString(1), Integer.parseInt(localCursor.getString(2)));
while (localCursor.moveToNext());
localCursor.close();
this.database.close();
return localQuote;
}
public ArrayList<Quote> getQuoteByLimit(int paramInt1, int paramInt2, String paramString)
{
ArrayList localArrayList = new ArrayList();
this.database = SQLiteDatabase.openDatabase(this.databasePath, null, 0);
if (paramString != null);
Cursor localCursor;
for (String str = "select quotes._id,quotes.body,quotes.is_favourist FROM quotes GROUP BY quotes._id ORDER BY body " + paramString + " Limit " + (paramInt1 - 1) + "," + paramInt2 + ";"; ; str = "select quotes._id,quotes.body,quotes.is_favourist FROM quotes GROUP BY quotes._id Limit " + (paramInt1 - 1) + "," + paramInt2 + ";")
{
WriteLog.d("ThangTB", "query: " + str);
localCursor = this.database.rawQuery(str, null);
if ((localCursor != null) && (localCursor.getCount() != 0))
break;
localCursor.close();
this.database.close();
return localArrayList;
}
localCursor.moveToFirst();
do
localArrayList.add(new Quote(Integer.parseInt(localCursor.getString(0)), localCursor.getString(1), Integer.parseInt(localCursor.getString(2))));
while (localCursor.moveToNext());
localCursor.close();
this.database.close();
return localArrayList;
}
public Quote getQuoteRandom(int paramInt)
{
Quote localQuote = null;
this.database = SQLiteDatabase.openDatabase(this.databasePath, null, 0);
while (true)
{
if (localQuote != null)
{
this.database.close();
WriteLog.d("ThangTB", "random quote = " + localQuote.getBody());
return localQuote;
}
int i = new Random().nextInt(paramInt + 1);
String str = "select quotes._id,quotes.body,quotes.is_favourist from quotes WHERE quotes._id =" + String.valueOf(i) + ";";
Cursor localCursor = this.database.rawQuery(str, null);
if ((localCursor == null) || (localCursor.getCount() == 0))
{
localCursor.close();
localQuote = null;
}
else
{
localCursor.moveToFirst();
do
localQuote = new Quote(Integer.parseInt(localCursor.getString(0)), localCursor.getString(1), Integer.parseInt(localCursor.getString(2)));
while (localCursor.moveToNext());
localCursor.close();
}
}
}
public ArrayList<Quote> getSearchQuoteByString(String paramString)
{
ArrayList localArrayList = new ArrayList();
this.database = SQLiteDatabase.openDatabase(this.databasePath, null, 0);
String str = "select quotes._id,quotes.body,quotes.is_favourist from quotes WHERE quotes.body like '%" + paramString + "%'" + " GROUP BY quotes._id " + " Order by body asc;";
Cursor localCursor = this.database.rawQuery(str, null);
if ((localCursor == null) || (localCursor.getCount() == 0))
{
localCursor.close();
this.database.close();
return localArrayList;
}
localCursor.moveToFirst();
do
localArrayList.add(new Quote(Integer.parseInt(localCursor.getString(0)), localCursor.getString(1), Integer.parseInt(localCursor.getString(2))));
while (localCursor.moveToNext());
localCursor.close();
this.database.close();
WriteLog.d("ThangTB", "query: " + str);
return localArrayList;
}
public int getTotalQuotesNoFilter()
{
int i = 0;
this.database = SQLiteDatabase.openDatabase(this.databasePath, null, 0);
WriteLog.d("ThangTB", "query: " + "SELECT count(quotes._id) FROM quotes;");
try
{
Cursor localCursor = this.database.rawQuery("SELECT count(quotes._id) FROM quotes;", null);
i = 0;
if (localCursor != null)
{
localCursor.moveToFirst();
i = localCursor.getInt(0);
}
if (localCursor != null)
localCursor.close();
return i;
}
catch (Exception localException)
{
return i;
}
finally
{
this.database.close();
}
}
}
这里我有一个错误告诉我:
Unreachable code
in: new StringBuilder("UPDATE qod SET quote_id = ").append(paramInt).append(",changed = ").append(localDate.getTime()).append(",body = \"\"").append(paramString).append("\"\" ;").toString();
我在很多文件中都有这个错误
提前致谢
因为你在上面的行中有 return true,这使得它退出 while 循环,这就是它无法访问的原因。
然后 Java 7 在 android 中不能很好地工作。
这是关于此的话题: 计算器。com/questions/9098684/
获取最新的 JDK 它应该可以正常工作!