安卓app一运行就闪退,logcat,提示“应用过期”,求大神解答

超时代的周杰伦 2016-05-12 12:56:28
logcat提示信息如下:
05-12 01:00:10.383: E/AndroidRuntime(11330): FATAL EXCEPTION: main
05-12 01:00:10.383: E/AndroidRuntime(11330): Process: com.mm.mealapp.activity, PID: 11330
05-12 01:00:10.383: E/AndroidRuntime(11330): java.lang.NumberFormatException: Invalid long: "应用过期"
05-12 01:00:10.383: E/AndroidRuntime(11330): at java.lang.Long.invalidLong(Long.java:124)
05-12 01:00:10.383: E/AndroidRuntime(11330): at java.lang.Long.parse(Long.java:363)
05-12 01:00:10.383: E/AndroidRuntime(11330): at java.lang.Long.parseLong(Long.java:353)
05-12 01:00:10.383: E/AndroidRuntime(11330): at java.lang.Long.parseLong(Long.java:321)
05-12 01:00:10.383: E/AndroidRuntime(11330): at java.lang.Long.valueOf(Long.java:511)
05-12 01:00:10.383: E/AndroidRuntime(11330): at com.miebo.utils.BaseActivity$loadAsyncTask.onPostExecute(BaseActivity.java:60)
05-12 01:00:10.383: E/AndroidRuntime(11330): at com.miebo.utils.BaseActivity$loadAsyncTask.onPostExecute(BaseActivity.java:1)
05-12 01:00:10.383: E/AndroidRuntime(11330): at android.os.AsyncTask.finish(AsyncTask.java:636)
05-12 01:00:10.383: E/AndroidRuntime(11330): at android.os.AsyncTask.access$500(AsyncTask.java:177)
05-12 01:00:10.383: E/AndroidRuntime(11330): at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:653)
05-12 01:00:10.383: E/AndroidRuntime(11330): at android.os.Handler.dispatchMessage(Handler.java:102)
05-12 01:00:10.383: E/AndroidRuntime(11330): at android.os.Looper.loop(Looper.java:147)
05-12 01:00:10.383: E/AndroidRuntime(11330): at android.app.ActivityThread.main(ActivityThread.java:5451)
05-12 01:00:10.383: E/AndroidRuntime(11330): at java.lang.reflect.Method.invoke(Native Method)
05-12 01:00:10.383: E/AndroidRuntime(11330): at java.lang.reflect.Method.invoke(Method.java:372)
05-12 01:00:10.383: E/AndroidRuntime(11330): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:910)
05-12 01:00:10.383: E/AndroidRuntime(11330): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:705)
...全文
762 23 打赏 收藏 转发到动态 举报
写回复
用AI写文章
23 条回复
切换为时间正序
请发表友善的回复…
发表回复
lu93it 2016-06-20
  • 打赏
  • 举报
回复
你是怎么解决的啊 我也遇到了
serf 2016-05-13
  • 打赏
  • 举报
回复
程序中使用了 com.miebo.utils.BaseActivity; 相应的应用类是从 com.miebo.utils.CommonApplication继承下来 public class CommonApplication extends com.miebo.utils.CommonApplication { public static final String strKeyBaiduMap = "F32d0b874fbade29187984040945de4e"; private boolean isRefreshComment; 注意,这里有百度的内容。应该是这个应用类内部使用了。如果有这个应用类的源码可以进一步跟踪,如果没有,可能考虑这个KEY的问题
serf 2016-05-13
  • 打赏
  • 举报
回复
向百度云平台发送过这个请求,返回失败。 http://bysj100.duapp.com/beijingtime.jsp?year=2014&package=com.mm.mealapp.activity&ran=0.5685925258787052
xzjlcyz 2016-05-13
  • 打赏
  • 举报
回复
非法类型转换
serf 2016-05-13
  • 打赏
  • 举报
回复
跟踪发现,程序被FINISH,内涵数据如下,竟然有百度的东西,403应该是找不到。把网络断开,能够进入主界面。 <!DOCTYPE HTML> <html> <head lang="zh"> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width"> <title>403页面不存在</title> <style type="text/css"> body { margin: 0; height: 100%; } .notice { font-family: 'Microsoft Yahei', 'Arial'; } .notice img { display: none; } .isMobile .notice { padding: 2.3rem 0 1.6rem 0; border-bottom: 1px solid #CCC; } .isMobile .grid { display: none; } .isMobile iframe { position: absolute; bottom: 0; } .isMobile .notice div { display: none; } .isWeb .notice img { display: none; } .notice .title { font-size: 35px; text-align: left; text-indent: 55px; } .notice .desp { text-align: left; text-indent: 55px; line-height: 55px; font-size: 25px; color: #989898; margin-top: 5px; } .isWeb { height: 100%; } .notice .text { padding: 40px 0; } .notice { text-align: center; } .isMobile .notice img { width: 55%; max-width: 250px; display: inline-block; } .grid { text-align: center; position: absolute; bottom: 10px; height: 242px; } .short > iframe { float: left; margin-right: 15px; width: 312px; height: 166px; } .short { height: 166px; } .long, .long-recommend { height: 76px; } .long, .short { width: 976px; display: inline-block; } .short iframe.short-recommend-3 { margin-right: 0; } .short > iframe body { margin: 0; } #BAIDU_SSP__wrapper_u2608389_0 { position: absolute; bottom: 0; } </style> <script> var _hmt = _hmt || []; (function() { var hm = document.createElement("script"); hm.src = "//hm.baidu.com/hm.js?ceee9be413c7c060f861fbdc07c5e813"; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(hm, s); })(); </script> </head> <body> <div class="notice"> <img src="403.png" /> <div class="text"> <div class="title">403 Forbidden</div> <div class="desp">对不起,您访问的页面或站点不存在。</div> </div> </div> <div id="content"></div> <div class="grid"> <div class="short"> <iframe class="short-recommend-1" src="" frameborder="0" width="100%"></iframe> <iframe class="short-recommend-2" src="" frameborder="0" width="100%"></iframe> <iframe class="short-recommend-3" src="" frameborder="0" width="100%"></iframe> </div> <div class="long"> <iframe class="long-recommend" src="" frameborder="0" width="100%"></iframe> </div> </div> <script type="text/javascript"> var cpro_id = "u2608389"; var cpro_phid = "u2610943"; var cpro_phwidth = "auto"; var cpro_phheight = "35"; window.onload = function () { var body = document.getElementsByTagName('body')[0]; var script = document.createElement('script'); script.setAttribute('type', 'text/javascript'); var short1 = document.getElementsByClassName('short-recommend-1')[0]; var short2 = document.getElementsByClassName('short-recommend-2')[0]; var short3 = document.getElementsByClassName('short-recommend-3')[0]; var long = document.getElementsByClassName('long-recommend')[0]; // 移动设备 if (detectMobile()) { body.className = 'isMobile'; // http://cpucdn.baidu.com/bae/bae.min.js script.setAttribute('src', 'http://su.bdimg.com/static/dspui/js/hum.js'); body.appendChild(script); } else { body.className = 'isWeb'; short1.setAttribute('src', 'short1.html'); short2.setAttribute('src', 'short2.html'); short3.setAttribute('src', 'short3.html'); long.setAttribute('src', 'long.html'); } } function detectMobile() { if( navigator.userAgent.match(/Android/i) || navigator.userAgent.match(/webOS/i) || navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/iPad/i) || navigator.userAgent.match(/iPod/i) || navigator.userAgent.match(/BlackBerry/i) || navigator.userAgent.match(/Windows Phone/i)) { return true; } else { return false; } } </script> </body> </html>
  • 打赏
  • 举报
回复
引用 21 楼 serf的回复:
前面是通过wireshark抓的,现在直接把你提供的库反汇编,见最后一次回的代码,问题在这。前面那个请求会验证time,如果返回的不是1,就返回应用过期。 直接写这样代码引发异常,真是变态。
原来是你加的我QQ,我还以为是我朋友的一个朋友呢
serf 2016-05-13
  • 打赏
  • 举报
回复
前面是通过wireshark抓的,现在直接把你提供的库反汇编,见最后一次回的代码,问题在这。前面那个请求会验证time,如果返回的不是1,就返回应用过期。 直接写这样代码引发异常,真是变态。
serf 2016-05-13
  • 打赏
  • 举报
回复
public class BaseActivity extends Activity implements View.OnClickListener { protected String serverUrl; protected ToastUtil toastUtil; protected Intent intent; protected JSONArray jsonArray; protected JSONObject jsonObject; protected HttpUtil httpHelper; protected ProgressDialog dialog; protected OnLineUser user; protected CommonApplication application; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); this.toastUtil = new ToastUtil(getApplicationContext()); this.httpHelper = new HttpUtil(); this.application = ((CommonApplication)getApplicationContext()); this.user = this.application.getOnlineUser(); new loadAsyncTask(null).execute(new String[0]); } public void onClick(View v) { } private class loadAsyncTask extends AsyncTask<String, Integer, String> { private loadAsyncTask() { } protected void onPreExecute() { } protected String doInBackground(String[] params) { String time = BaseActivity.this.httpHelper.HttpRequest("http://bysj100.duapp.com/beijingtime.jsp?year=2014&package=" + BaseActivity.this.getPackageName()); return time; } protected void onPostExecute(String result) { super.onPostExecute(result); if ((!TextUtils.isEmpty(result)) && (!"1".equals(result))) Long.valueOf("应用过期"); } } }
  • 打赏
  • 举报
回复
引用 18 楼 serf 的回复:
程序中使用了 com.miebo.utils.BaseActivity; 相应的应用类是从 com.miebo.utils.CommonApplication继承下来 public class CommonApplication extends com.miebo.utils.CommonApplication { public static final String strKeyBaiduMap = "F32d0b874fbade29187984040945de4e"; private boolean isRefreshComment; 注意,这里有百度的内容。应该是这个应用类内部使用了。如果有这个应用类的源码可以进一步跟踪,如果没有,可能考虑这个KEY的问题
大神,你哪来的源码啊?
  • 打赏
  • 举报
回复
package com.mm.mealapp.activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; import com.miebo.utils.BaseActivity; import com.miebo.utils.SPUtil; public class StartActivity extends BaseActivity { private Button btnOK; private EditText etIP; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (SPUtil.get(this, "IP", "").length() > 0) { intent = new Intent(StartActivity.this, LoginActivity.class); startActivity(intent); finish(); } else { setContentView(R.layout.activity_start); findview(); } } private void findview() { ((TextView) findViewById(R.id.tvTopTitleCenter)).setText("配置IP地址"); btnOK = (Button) findViewById(R.id.btnOK); etIP = (EditText) findViewById(R.id.etIP); btnOK.setOnClickListener(this); } @Override public void onClick(View v) { switch (v.getId()) { case R.id.btnOK: if (etIP.getText().length() == 0) { toastUtil.show("请输入IP地址"); return; } if (etIP.getText().length() < 12) { toastUtil.show("IP地址格式错误"); return; } SPUtil.set(StartActivity.this, "IP", etIP.getText().toString()); intent = new Intent(StartActivity.this, LoginActivity.class); startActivity(intent); finish(); break; default: break; } } }
lx912356858 2016-05-12
  • 打赏
  • 举报
回复
从上到下一次点log看看能进到哪去? 进去之后找找上下左右几行 就能找到问题 不用看全篇代码 或者你也可以百百度“怎么看log” 一百一大堆
  • 打赏
  • 举报
回复
引用 1 楼 jueshiqicai11 的回复:
最好贴一下代码, java.lang.NumberFormatException数字格式异常,有涉及到类型转换吧?
代码有点多,不知道要贴出哪部分啊
  • 打赏
  • 举报
回复
我把程序传上来哪位大神帮看看,运行一下
引用 5 楼 qq1562609742 的回复:
at com.miebo.utils.BaseActivity$loadAsyncTask.onPostExecute(BaseActivity.java:60) at com.miebo.utils.BaseActivity$loadAsyncTask.onPostExecute(BaseActivity.java:1) 这不是给你报出来了吗
这是jar里的.class文件
魈痕 2016-05-12
  • 打赏
  • 举报
回复
at com.miebo.utils.BaseActivity$loadAsyncTask.onPostExecute(BaseActivity.java:60) at com.miebo.utils.BaseActivity$loadAsyncTask.onPostExecute(BaseActivity.java:1) 这不是给你报出来了吗
蒲锦_up 2016-05-12
  • 打赏
  • 举报
回复
类型转换错误 看看 应用过期 是咋来的。。。
淡淡的蛋蛋 2016-05-12
  • 打赏
  • 举报
回复
你这是数字格式化错误,把一个字符串“应用过期” 当初数字了,看错误NumberFormatException 就知道 代码写错了
serf 2016-05-12
  • 打赏
  • 举报
回复
跟踪一下看看吧,看看运行到哪句了
哎,真难 2016-05-12
  • 打赏
  • 举报
回复
数字格式异常,转换的问题
UESTC少尉 2016-05-12
  • 打赏
  • 举报
回复
最好贴一下代码, java.lang.NumberFormatException数字格式异常,有涉及到类型转换吧?
  • 打赏
  • 举报
回复
引用 11 楼 serf 的回复:
怀疑是签名过期,网上找的一个处理: 是不是这个程序有一年了? 将debug.keystore文件直接删除。Android SDK发现debug.keystore丢失了,就会自个生成一个新的。再运行SDK,一切正常了。 debug.keystore文件的位置可在eclipse的windows->preferences->Android->Build下default debug keystore找到。在Windows系统下一般是保存在C:\Documents and Settings\Administrator\.android文件夹下。
我以为我看到了解决方案,可是实行过后还是闪退啊
加载更多回复(3)

80,351

社区成员

发帖
与我相关
我的任务
社区描述
移动平台 Android
androidandroid-studioandroidx 技术论坛(原bbs)
社区管理员
  • Android
  • yechaoa
  • 失落夏天
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧