我的项目成功运行,但当我导出apk时,它在Prograd项目中崩溃了。文本
# To enable ProGuard in your project, edit project.properties
# to define the proguard.config property as described in that file.
#
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in ${sdk.dir}/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the ProGuard
# include property in project.properties.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
-dontwarn twitter4j.internal.logging.**
-dontwarn org.apache.http.**
-dontwarn org.apache.poi.hssf.usermodel.HSSFWorkbook.**
-ignorewarnings
但错误
致命异常:AsyncTask#1 java。lang.RuntimeException:在android上执行doInBackground()时出错。操作系统。异步任务3美元。在java上完成(AsyncTask.java:299)。util。同时发生的未来任务。在java上完成(FutureTask.java:352)。util。同时发生的未来任务。java上的setException(FutureTask.java:219)。util。同时发生的未来任务。在android上运行(FutureTask.java:239)。操作系统。AsyncTask$SerialExecutor$1。在java上运行(AsyncTask.java:230)。util。同时发生的线程池执行器。java上的runWorker(ThreadPoolExecutor.java:1080)。util。同时发生的线程池执行器$Worker。在java上运行(ThreadPoolExecutor.java:573)。朗。丝线。运行(Thread.java:856)的原因是:java。lang.ExceptionInInitializerError位于组织。阿帕奇。波伊。hssf。用户模型。HSSF工作手册。(未知来源)在组织。阿帕奇。波伊。hssf。用户模型。HSSF工作手册。(未知来源)在组织。阿帕奇。波伊。hssf。用户模型。HSSF工作手册。(未知来源)在组织。阿帕奇。波伊。hssf。用户模型。HSSF工作手册。(未知来源)在com。大学生HTMLCSS。启动屏幕。com上的一个(未知源)。大学生HTMLCSS。z、 com上的一个(未知源)。大学生HTMLCSS。z、 android上的doInBackground(未知来源)。操作系统。异步任务$2。在java上调用(AsyncTask.java:287)。util。同时发生的未来任务。运行(FutureTask.java:234)4次以上,原因是:org。阿帕奇。波伊。hssf。b、 do:无法确定组织上的记录类型。阿帕奇。波伊。hssf。b、 迪。组织中的一个(未知来源)。阿帕奇。波伊。hssf。b、 迪。(来源不明)
密码
setContentView(R.layout.splash_screen);
progress = (ImageView) findViewById(R.id.imgprogress);
FontHelper.applyFont(this, findViewById(R.id.RelativeLayout1),
"helveticaneueltstdlt.ttf");
helper = new MyDBHelper(this);
final Integer[] mThumbIds = {
R.drawable.frame1, R.drawable.frame2, R.drawable.frame3,
R.drawable.frame4,
};
if (getLoginPreferences()) {
try {
r = new Runnable() {
public void run() {
progress.setBackgroundResource(mThumbIds[i]);
i++;
if (i >= mThumbIds.length) {
i = 0;
}
progress.postDelayed(r, 300); // set to go off again in
}
};
progress.postDelayed(r, 300);
}
catch (Exception e)
{
}
Handler mHandler = new Handler();
mHandler.postDelayed(new Runnable() {
@Override
public void run() {
setLoginPreferences("1");
startActivity(new Intent(splash_screen.this,
category_screen.class));
finish();
}
}, 2000);
}
else
{
start = true;
try {
r = new Runnable() {
public void run() {
progress.setBackgroundResource(mThumbIds[i]);
i++;
if (i >= mThumbIds.length) {
i = 0;
}
progress.postDelayed(r, 3000); // set to go off again in
// 3 seconds.
}
};
progress.postDelayed(r, 3000);
}
catch (Exception e) {
}
new data().execute();
}
}
void getData() {
if (!getLoginPreferences()) {
try {
InputStream is = getResources().getAssets().open(
"education.xls");
HSSFWorkbook workbook = new HSSFWorkbook(is);
// Get first sheet from the workbook
System.out.println("number of sheet="
+ workbook.getNumberOfSheets());
for (int sheetno = 0; sheetno <= 7; sheetno++) {
HSSFSheet sheet = workbook.getSheetAt(sheetno);
if (sheetno == 0 || sheetno == 2 || sheetno == 4
|| sheetno == 6) {
Row row;
Cell cell;
// Iterate through each rows from first sheet
Iterator<Row> rowIterator = sheet.iterator();
while (rowIterator.hasNext()) {
flag = 1;
row = rowIterator.next();
// For each row, iterate through each columns
Iterator<Cell> cellIterator = row.cellIterator();
while (cellIterator.hasNext()) {
cell = cellIterator.next();
System.out.println("row index="
+ cell.getRowIndex());
if (cell.getRowIndex() > 0) {
flag = 0;
switch (cell.getCellType()) {
case Cell.CELL_TYPE_BOOLEAN:
System.out.println("bool="
+ cell.getBooleanCellValue());
break;
case Cell.CELL_TYPE_NUMERIC:
id = (int) cell.getNumericCellValue();
System.out.println("number="
+ cell.getNumericCellValue());
break;
case Cell.CELL_TYPE_STRING:
System.out.println("col number="
+ cell.getColumnIndex());
System.out.println("string="
+ cell.getStringCellValue());
if (cell.getColumnIndex() == 1) {
name = cell.getStringCellValue();
} else if (cell.getColumnIndex() == 2) {
uses = cell.getStringCellValue();
} else if (cell.getColumnIndex() == 3) {
example = cell.getStringCellValue();
}
break;
case Cell.CELL_TYPE_BLANK:
System.out.println(" ");
break;
default:
System.out.println(cell);
}
}
}
if (flag == 0) {
System.out.println(id + " " + name + " "
+ uses + " " + example);
if (sheetno == 0)
helper.addContact(0, new Contact(id, name,
uses, example));
if (sheetno == 2)
helper.addContact(2, new Contact(id, name,
uses, example));
if (sheetno == 4)
helper.addContact(4, new Contact(id, name,
uses, example));
if (sheetno == 6)
helper.addContact(6, new Contact(id, name,
uses, example));
name = "";
uses = "";
example = "";
}
}
} else {
Row row;
Cell cell;
flag = 1;
// Iterate through each rows from first sheet
Iterator<Row> rowIterator = sheet.iterator();
while (rowIterator.hasNext()) {
flag = 1;
row = rowIterator.next();
// For each row, iterate through each columns
Iterator<Cell> cellIterator = row.cellIterator();
while (cellIterator.hasNext()) {
cell = cellIterator.next();
System.out.println("row index="
+ cell.getRowIndex());
if (cell.getRowIndex() > 0) {
flag = 0;
switch (cell.getCellType()) {
case Cell.CELL_TYPE_BOOLEAN:
System.out.println("bool="
+ cell.getBooleanCellValue());
break;
case Cell.CELL_TYPE_NUMERIC:
if (cell.getColumnIndex() == 0)
ha_id = (int) cell
.getNumericCellValue();
else if (cell.getColumnIndex() == 1)
id = (int) cell
.getNumericCellValue();
System.out.println("number="
+ cell.getNumericCellValue());
break;
case Cell.CELL_TYPE_STRING:
System.out.println("col number="
+ cell.getColumnIndex());
System.out.println("string="
+ cell.getStringCellValue());
if (cell.getColumnIndex() == 2) {
name = cell.getStringCellValue();
} else if (cell.getColumnIndex() == 3) {
uses = cell.getStringCellValue();
} else if (cell.getColumnIndex() == 4) {
example = cell.getStringCellValue();
}
break;
case Cell.CELL_TYPE_BLANK:
System.out.println(" ");
break;
default:
System.out.println(cell);
}
}
}
if (flag == 0) {
System.out.println(id + " " + name + " "
+ uses + " " + example);
if (sheetno == 1)
helper.addAttribute(1, new Contact(ha_id,
id, name, uses, example));
if (sheetno == 3)
helper.addAttribute(3, new Contact(ha_id,
id, name, uses, example));
if (sheetno == 5)
helper.addAttribute(5, new Contact(ha_id,
id, name, uses, example));
if (sheetno == 7)
helper.addAttribute(7, new Contact(ha_id,
id, name, uses, example));
name = "";
uses = "";
example = "";
}
}
}
}
} catch (FileNotFoundException e) {
Toast.makeText(getApplicationContext(), e.getMessage(),
Toast.LENGTH_LONG).show();
e.printStackTrace();
}
catch (IOException e) {
// TODO Auto-generated catch block
Toast.makeText(getApplicationContext(), e.getMessage(),
Toast.LENGTH_LONG).show();
e.printStackTrace();
}
}
start = false;
}
private boolean getLoginPreferences() {
boolean isLogin = false;
String strUsername = "";
// try {
SharedPreferences preferences = getSharedPreferences("LOGIN",
MODE_WORLD_READABLE);
strUsername = preferences.getString("TABLE_EXITS", "");
if (!strUsername.trim().equals("")) {
isLogin = true;
} else {
isLogin = false;
}
System.out.println("value in " + strUsername);
/*
* } catch (Exception e) { // TODO: handle exception
* System.out.println("Error at Get login : " + e.toString()); }
*/
return isLogin;
}
private void setLoginPreferences(String strUsername) {
try {
SharedPreferences preferences = getSharedPreferences("LOGIN",
MODE_WORLD_WRITEABLE);
SharedPreferences.Editor editor = preferences.edit();
editor.putString("TABLE_EXITS", strUsername.trim());
editor.commit();
System.out.println("sign-up prefrences:" + strUsername);
} catch (Exception e) {
// TODO: handle exception
System.out.println("Error at Set login : " + e.toString());
}
}
public class data extends AsyncTask<Void, Void, Void> {
@Override
protected void onPreExecute() {
// TODO Auto-generated method stub
super.onPreExecute();
}
@Override
protected Void doInBackground(Void... params) {
// TODO Auto-generated method stub
getData();
return null;
}
@Override
protected void onPostExecute(Void result) {
// TODO Auto-generated method stub
super.onPostExecute(result);
setLoginPreferences("1");
startActivity(new Intent(splash_screen.this, category_screen.class));
finish();
}
}
请给我一个解决方案。
Add in proguard-project.txt
-keep public class java.awt.**
{
public protected *;
}
-keep public class javax.swing.**
{
public protected *;
}
-keep public class javax.imageio.**
{
public protected *;
}
-keep public class org.apache.commons.logging.LogFactory
{
public protected *;
}
-keep public class java.rmi.UnexpectedException
{
public protected *;
}
-dontwarn twitter4j.internal.logging.**
-dontwarn org.apache.http.**
-dontwarn java.awt.**
-dontwarn javax.swing.**
-dontwarn javax.imageio.**
-dontwarn org.apache.commons.logging.LogFactory
-dontwarn java.rmi.UnexpectedException
-libraryjars /libs/GoogleAdMobAdsSdk-6.4.1.jar
-libraryjars /libs/poi-3.7.jar
我已经在我的gradle文件中启用了来使用ProGuard的特性来混淆代码,结果导致一些错误。 注意:动态创建的类实例有1个类强制转换。您可能会考虑显式保留提到的类和/或它们的实现(使用'-keep')。 警告:有309个未解析的类或接口引用。您可能需要添加丢失的库JAR或更新它们的版本。如果您的代码在没有丢失类的情况下运行良好,则可以使用'-dontwarn'选项抑制警告。(http://pro
我尝试使用“testsign.jar”对apk进行“签名”,但它不会改变结果
问题内容: 当我尝试在运行4.2.1的Nexus 4上运行我的应用程序时,我不断在Eclipse中遇到此错误: 我厌倦了通过adb推送和安装,但是也没有用。我发现这是由于Logcat中的以下消息: 有关如何解决此问题的任何想法? 问题答案: 如果设备上已经具有该应用程序的签名版本且具有相同的软件包名称,则可能需要先将其卸载,然后再重新安装(除非您要再次对其进行签名,然后将该签名的应用程序上载到该设
我已经创建了一个Android应用程序,我想将其导出为. apk文件,以便与他人共享,有人能告诉我如何创建和共享. apk文件吗?使用Android Studio.
我在2010年的MacBook Pro上使用Mac OS X 10.7.4,并使用以下Java: 我用的是ADT20。 我尝试重新安装Eclipse和Android SDK,并重新下载ADT。
我是PGP的新手,我正试图通过本教程使用GnuPG生成一个PGP私钥。 基本上,我在命令提示符(管理员模式)中键入以下命令: 然后我输入了命令: 如果这不可能,我如何与解密的独立应用程序共享所有计算机的私钥(因为据我所知,独立应用程序需要“一个”私钥来解密文件)?我应该使用多个私钥吗?如何落实?