Skip to content

Commit

Permalink
Site updated: 2015-05-28 16:32:15
Browse files Browse the repository at this point in the history
  • Loading branch information
Jathew committed May 28, 2015
1 parent 88d8892 commit 3de0360
Show file tree
Hide file tree
Showing 8 changed files with 130 additions and 88 deletions.
8 changes: 4 additions & 4 deletions 2015/05/16/Android Proguard详解/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ <h4 id="文件">文件</h4><p>mapping.txt<br>表示混淆前后代码的对照
</div>
<footer class="article-footer">

<a data-url="http://jathew.github.io/2015/05/16/Android Proguard详解/" data-id="cia6a2q4o0000ecpxbl0ds3nt" class="article-share-link" data-share="baidu">分享到</a>
<a data-url="http://jathew.github.io/2015/05/16/Android Proguard详解/" data-id="cia7x33l80000fgpxmalc4yk3" class="article-share-link" data-share="baidu">分享到</a>



Expand All @@ -128,11 +128,11 @@ <h4 id="文件">文件</h4><p>mapping.txt<br>表示混淆前后代码的对照

<nav id="article-nav">

<a href="/2015/05/27/Android 异常/" id="article-nav-newer" class="article-nav-link-wrap">
<a href="/2015/05/28/Android 异常(不定期更新)/" id="article-nav-newer" class="article-nav-link-wrap">
<strong class="article-nav-caption">下一篇</strong>
<div class="article-nav-title">

Android 异常(不定期更新
Android异常(不定期更新)

</div>
</a>
Expand Down Expand Up @@ -187,7 +187,7 @@ <h3 class="widget-title">近期文章</h3>
<ul>

<li>
<a href="/2015/05/27/Android 异常/">Android 异常(不定期更新</a>
<a href="/2015/05/28/Android 异常(不定期更新)/">Android异常(不定期更新)</a>
</li>

<li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@
<head>
<meta charset="utf-8">

<title>Android 异常(不定期更新 | Jathew&#39;s blog</title>
<title>Android异常(不定期更新) | Jathew&#39;s blog</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="description" content="关键字:JNI ERROR (app bug): accessed stale local reference、jclass is an invalid local referencelogE/art﹕ JNI ERROR (app bug): accessed stale local reference 0x5950001d (index 7 in a table of size 1)
E/ar">
<meta name="description" content="Exception 1关键字:JNI ERROR (app bug): accessed stale local reference、jclass is an invalid local reference
logE/art﹕ JNI ERROR (app bug): accessed stale local reference 0x5950001d (index 7 in a table of">
<meta property="og:type" content="article">
<meta property="og:title" content="Android 异常(不定期更新">
<meta property="og:url" content="http://jathew.github.io/2015/05/27/Android 异常/index.html">
<meta property="og:title" content="Android异常(不定期更新)">
<meta property="og:url" content="http://jathew.github.io/2015/05/28/Android 异常(不定期更新)/index.html">
<meta property="og:site_name" content="Jathew's blog">
<meta property="og:description" content="关键字:JNI ERROR (app bug): accessed stale local reference、jclass is an invalid local referencelogE/art﹕ JNI ERROR (app bug): accessed stale local reference 0x5950001d (index 7 in a table of size 1)
E/ar">
<meta property="og:description" content="Exception 1关键字:JNI ERROR (app bug): accessed stale local reference、jclass is an invalid local reference
logE/art﹕ JNI ERROR (app bug): accessed stale local reference 0x5950001d (index 7 in a table of">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Android 异常(不定期更新">
<meta name="twitter:description" content="关键字:JNI ERROR (app bug): accessed stale local reference、jclass is an invalid local referencelogE/art﹕ JNI ERROR (app bug): accessed stale local reference 0x5950001d (index 7 in a table of size 1)
E/ar">
<meta name="twitter:title" content="Android异常(不定期更新)">
<meta name="twitter:description" content="Exception 1关键字:JNI ERROR (app bug): accessed stale local reference、jclass is an invalid local reference
logE/art﹕ JNI ERROR (app bug): accessed stale local reference 0x5950001d (index 7 in a table of">

<link rel="alternative" href="/atom.xml" title="Jathew&#39;s blog" type="application/atom+xml">

Expand Down Expand Up @@ -75,10 +75,10 @@ <h2 id="subtitle-wrap">
</div>
</header>
<div class="outer">
<section id="main"><article id="post-Android 异常" class="article article-type-post" itemscope itemprop="blogPost">
<section id="main"><article id="post-Android 异常(不定期更新)" class="article article-type-post" itemscope itemprop="blogPost">
<div class="article-meta">
<a href="/2015/05/27/Android 异常/" class="article-date">
<time datetime="2015-05-27T04:54:28.678Z" itemprop="datePublished">2015-05-27</time>
<a href="/2015/05/28/Android 异常(不定期更新)/" class="article-date">
<time datetime="2015-05-28T08:31:14.169Z" itemprop="datePublished">2015-05-28</time>
</a>

</div>
Expand All @@ -89,36 +89,43 @@ <h2 id="subtitle-wrap">


<h1 class="article-title" itemprop="name">
Android 异常(不定期更新
Android异常(不定期更新)
</h1>


</header>

<div class="article-entry" itemprop="articleBody">

<h2 id="关键字:JNI_ERROR_(app_bug):_accessed_stale_local_reference、jclass_is_an_invalid_local_reference">关键字:JNI ERROR (app bug): accessed stale local reference、jclass is an invalid local reference</h2><h2 id="log">log</h2><pre><code><span class="keyword">E</span>/art﹕ JNI <span class="keyword">ERROR</span> (<span class="keyword">app</span> bug): accessed stale <span class="keyword">local</span> reference 0x5950001d (index 7 <span class="keyword">in</span> a <span class="keyword">table</span> of size 1)
<h2 id="Exception_1">Exception 1</h2><h4 id="关键字:">关键字:</h4><p>JNI ERROR (app bug): accessed stale local reference、jclass is an invalid local reference</p>
<h4 id="log">log</h4><pre><code><span class="keyword">E</span>/art﹕ JNI <span class="keyword">ERROR</span> (<span class="keyword">app</span> bug): accessed stale <span class="keyword">local</span> reference 0x5950001d (index 7 <span class="keyword">in</span> a <span class="keyword">table</span> of size 1)
<span class="keyword">E</span>/art﹕ 0xa96b4c00 SpaceTypeMallocSpace begin=0x12c00000,end=0x13001000,limit=0x32c00000,size=4MB,capacity=512MB,non_growth_limit_capacity=512MB,name="main
art/runtime/check_jni.<span class="keyword">cc</span>:65] JNI DETECTED <span class="keyword">ERROR</span> <span class="keyword">IN</span> APPLICATION: jclass is <span class="keyword">an</span> invalid <span class="keyword">local</span> reference: 0x5950001d (0xdead4321)
<span class="keyword">E</span>/art﹕ [ 05-26 16:03:20.096 26663:26768 F/art ]
art/runtime/check_jni.<span class="keyword">cc</span>:65] JNI DETECTED <span class="keyword">ERROR</span> <span class="keyword">IN</span> APPLICATION: jclass is <span class="keyword">an</span> invalid <span class="keyword">local</span> reference: 0x5950001d (0xdead4321)
</code></pre><h2 id="现象">现象</h2><p>android5.0以上,调用jni相关方法后,程序崩溃</p>
<h2 id="原因及解决办法">原因及解决办法</h2><p>通过findclass获得的local reference在5.0以上版本会被系统gc掉,导致后续使用的地方会无效。现在的解决方案是使用NewGlobalRef,如下</p>
</code></pre><h4 id="现象">现象</h4><p>android5.0以上,调用jni相关方法后,程序崩溃</p>
<h4 id="原因及解决办法">原因及解决办法</h4><p>通过findclass获得的local<br>reference在5.0以上版本会被系统gc掉,导致后续使用的地方会无效。现在的解决方案是使用NewGlobalRef,如下</p>
<pre><code>jclass myclass;
jclass temp = <span class="built_ins">env</span>-&gt;findclass(XXXX);
myclass = (jclass)<span class="built_ins">env</span>-&gt;NewGlobalRef(temp);
</code></pre><p>记得要调用DeleteGlobalRef</p>
<p> 另外以下几个链接也可以参考一下<br> <a href="http://android-developers.blogspot.com/2011/11/jni-local-reference-changes-in-ics.html" target="_blank" rel="external">JNI Local Reference Changes in ICS</a><br> <a href="http://blog.k-res.net/archives/1525.html" target="_blank" rel="external">国内的翻译</a></p>
<p>另外以下几个链接也可以参考一下 <a href="http://android-developers.blogspot.com/2011/11/jni-local-reference-changes-in-ics.html" target="_blank" rel="external">JNI Local Reference Changes in<br>ICS</a><br><a href="http://blog.k-res.net/archives/1525.html" target="_blank" rel="external">国内的翻译</a></p>
<h2 id="Exception_2">Exception 2</h2><h4 id="关键字:-1">关键字:</h4><p>Error type 3, activity class does not exist</p>
<h4 id="log-1">log</h4><pre><code>Starting: <span class="type">Intent</span> { act=android.<span class="type">intent</span>.<span class="keyword">action</span>.MAIN cat=[android.<span class="type">intent</span>.category.LAUNCHER] cmp=com.codealchemist.clashmma/.splash }
Error <span class="keyword">type</span> <span class="number">3</span>
Error: Activity <span class="keyword">class</span> {com.codealchemist.clashmma/com.codealchemist.clashmma.splash} does not <span class="keyword">exist</span>.
</code></pre><h4 id="现象-1">现象</h4><p>用android studio运行app,如果修改了包名,启动的时候会出现如下错误</p>
<h4 id="原因及解决办法-1">原因及解决办法</h4><p>在build.gradle中把 apply plugin: ‘android’ 改为 apply plugin: ‘com.android.application’</p>


</div>
<footer class="article-footer">

<a data-url="http://jathew.github.io/2015/05/27/Android 异常/" data-id="cia6a2q7s0004ecpxaigxe19x" class="article-share-link" data-share="baidu">分享到</a>
<a data-url="http://jathew.github.io/2015/05/28/Android 异常(不定期更新)/" data-id="cia7x33nq0004fgpx4uyrsegi" class="article-share-link" data-share="baidu">分享到</a>



<a href="http://jathew.github.io/2015/05/27/Android 异常/#ds-thread" class="article-comment-link">评论</a>
<a href="http://jathew.github.io/2015/05/28/Android 异常(不定期更新)/#ds-thread" class="article-comment-link">评论</a>



Expand All @@ -143,7 +150,7 @@ <h2 id="原因及解决办法">原因及解决办法</h2><p>通过findclass获


<section id="comments">
<div id="ds-thread" class="ds-thread" data-thread-key="2015/05/27/Android 异常/" data-title="Android 异常(不定期更新" data-url="http://jathew.github.io/2015/05/27/Android 异常/"></div>
<div id="ds-thread" class="ds-thread" data-thread-key="2015/05/28/Android 异常(不定期更新)/" data-title="Android异常(不定期更新)" data-url="http://jathew.github.io/2015/05/28/Android 异常(不定期更新)/"></div>
</section>
</section>

Expand Down Expand Up @@ -185,7 +192,7 @@ <h3 class="widget-title">近期文章</h3>
<ul>

<li>
<a href="/2015/05/27/Android 异常/">Android 异常(不定期更新</a>
<a href="/2015/05/28/Android 异常(不定期更新)/">Android异常(不定期更新)</a>
</li>

<li>
Expand Down
4 changes: 2 additions & 2 deletions about/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ <h1 class="article-title" itemprop="name">
</div>
<footer class="article-footer">

<a data-url="http://jathew.github.io/about/index.html" data-id="cia6a2q7b0003ecpx0oo2xfrj" class="article-share-link" data-share="baidu">分享到</a>
<a data-url="http://jathew.github.io/about/index.html" data-id="cia7x33nf0003fgpxx70u4ffv" class="article-share-link" data-share="baidu">分享到</a>



Expand Down Expand Up @@ -160,7 +160,7 @@ <h3 class="widget-title">近期文章</h3>
<ul>

<li>
<a href="/2015/05/27/Android 异常/">Android 异常(不定期更新</a>
<a href="/2015/05/28/Android 异常(不定期更新)/">Android异常(不定期更新)</a>
</li>

<li>
Expand Down
31 changes: 19 additions & 12 deletions archives/2015/05/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,10 @@ <h2 id="subtitle-wrap">
<div class="outer">
<section id="main">

<article id="post-Android 异常" class="article article-type-post" itemscope itemprop="blogPost">
<article id="post-Android 异常(不定期更新)" class="article article-type-post" itemscope itemprop="blogPost">
<div class="article-meta">
<a href="/2015/05/27/Android 异常/" class="article-date">
<time datetime="2015-05-27T04:54:28.678Z" itemprop="datePublished">2015-05-27</time>
<a href="/2015/05/28/Android 异常(不定期更新)/" class="article-date">
<time datetime="2015-05-28T08:31:14.169Z" itemprop="datePublished">2015-05-28</time>
</a>

</div>
Expand All @@ -88,36 +88,43 @@ <h2 id="subtitle-wrap">


<h1 itemprop="name">
<a class="article-title" href="/2015/05/27/Android 异常/">Android 异常(不定期更新</a>
<a class="article-title" href="/2015/05/28/Android 异常(不定期更新)/">Android异常(不定期更新)</a>
</h1>


</header>

<div class="article-entry" itemprop="articleBody">

<h2 id="关键字:JNI_ERROR_(app_bug):_accessed_stale_local_reference、jclass_is_an_invalid_local_reference">关键字:JNI ERROR (app bug): accessed stale local reference、jclass is an invalid local reference</h2><h2 id="log">log</h2><pre><code><span class="keyword">E</span>/art﹕ JNI <span class="keyword">ERROR</span> (<span class="keyword">app</span> bug): accessed stale <span class="keyword">local</span> reference 0x5950001d (index 7 <span class="keyword">in</span> a <span class="keyword">table</span> of size 1)
<h2 id="Exception_1">Exception 1</h2><h4 id="关键字:">关键字:</h4><p>JNI ERROR (app bug): accessed stale local reference、jclass is an invalid local reference</p>
<h4 id="log">log</h4><pre><code><span class="keyword">E</span>/art﹕ JNI <span class="keyword">ERROR</span> (<span class="keyword">app</span> bug): accessed stale <span class="keyword">local</span> reference 0x5950001d (index 7 <span class="keyword">in</span> a <span class="keyword">table</span> of size 1)
<span class="keyword">E</span>/art﹕ 0xa96b4c00 SpaceTypeMallocSpace begin=0x12c00000,end=0x13001000,limit=0x32c00000,size=4MB,capacity=512MB,non_growth_limit_capacity=512MB,name="main
art/runtime/check_jni.<span class="keyword">cc</span>:65] JNI DETECTED <span class="keyword">ERROR</span> <span class="keyword">IN</span> APPLICATION: jclass is <span class="keyword">an</span> invalid <span class="keyword">local</span> reference: 0x5950001d (0xdead4321)
<span class="keyword">E</span>/art﹕ [ 05-26 16:03:20.096 26663:26768 F/art ]
art/runtime/check_jni.<span class="keyword">cc</span>:65] JNI DETECTED <span class="keyword">ERROR</span> <span class="keyword">IN</span> APPLICATION: jclass is <span class="keyword">an</span> invalid <span class="keyword">local</span> reference: 0x5950001d (0xdead4321)
</code></pre><h2 id="现象">现象</h2><p>android5.0以上,调用jni相关方法后,程序崩溃</p>
<h2 id="原因及解决办法">原因及解决办法</h2><p>通过findclass获得的local reference在5.0以上版本会被系统gc掉,导致后续使用的地方会无效。现在的解决方案是使用NewGlobalRef,如下</p>
</code></pre><h4 id="现象">现象</h4><p>android5.0以上,调用jni相关方法后,程序崩溃</p>
<h4 id="原因及解决办法">原因及解决办法</h4><p>通过findclass获得的local<br>reference在5.0以上版本会被系统gc掉,导致后续使用的地方会无效。现在的解决方案是使用NewGlobalRef,如下</p>
<pre><code>jclass myclass;
jclass temp = <span class="built_ins">env</span>-&gt;findclass(XXXX);
myclass = (jclass)<span class="built_ins">env</span>-&gt;NewGlobalRef(temp);
</code></pre><p>记得要调用DeleteGlobalRef</p>
<p> 另外以下几个链接也可以参考一下<br> <a href="http://android-developers.blogspot.com/2011/11/jni-local-reference-changes-in-ics.html" target="_blank" rel="external">JNI Local Reference Changes in ICS</a><br> <a href="http://blog.k-res.net/archives/1525.html" target="_blank" rel="external">国内的翻译</a></p>
<p>另外以下几个链接也可以参考一下 <a href="http://android-developers.blogspot.com/2011/11/jni-local-reference-changes-in-ics.html" target="_blank" rel="external">JNI Local Reference Changes in<br>ICS</a><br><a href="http://blog.k-res.net/archives/1525.html" target="_blank" rel="external">国内的翻译</a></p>
<h2 id="Exception_2">Exception 2</h2><h4 id="关键字:-1">关键字:</h4><p>Error type 3, activity class does not exist</p>
<h4 id="log-1">log</h4><pre><code>Starting: <span class="type">Intent</span> { act=android.<span class="type">intent</span>.<span class="keyword">action</span>.MAIN cat=[android.<span class="type">intent</span>.category.LAUNCHER] cmp=com.codealchemist.clashmma/.splash }
Error <span class="keyword">type</span> <span class="number">3</span>
Error: Activity <span class="keyword">class</span> {com.codealchemist.clashmma/com.codealchemist.clashmma.splash} does not <span class="keyword">exist</span>.
</code></pre><h4 id="现象-1">现象</h4><p>用android studio运行app,如果修改了包名,启动的时候会出现如下错误</p>
<h4 id="原因及解决办法-1">原因及解决办法</h4><p>在build.gradle中把 apply plugin: ‘android’ 改为 apply plugin: ‘com.android.application’</p>


</div>
<footer class="article-footer">

<a data-url="http://jathew.github.io/2015/05/27/Android 异常/" data-id="cia6a2q7s0004ecpxaigxe19x" class="article-share-link" data-share="baidu">分享到</a>
<a data-url="http://jathew.github.io/2015/05/28/Android 异常(不定期更新)/" data-id="cia7x33nq0004fgpx4uyrsegi" class="article-share-link" data-share="baidu">分享到</a>



<a href="http://jathew.github.io/2015/05/27/Android 异常/#ds-thread" class="article-comment-link">评论</a>
<a href="http://jathew.github.io/2015/05/28/Android 异常(不定期更新)/#ds-thread" class="article-comment-link">评论</a>



Expand Down Expand Up @@ -167,7 +174,7 @@ <h4 id="文件">文件</h4><p>mapping.txt<br>表示混淆前后代码的对照
</div>
<footer class="article-footer">

<a data-url="http://jathew.github.io/2015/05/16/Android Proguard详解/" data-id="cia6a2q4o0000ecpxbl0ds3nt" class="article-share-link" data-share="baidu">分享到</a>
<a data-url="http://jathew.github.io/2015/05/16/Android Proguard详解/" data-id="cia7x33l80000fgpxmalc4yk3" class="article-share-link" data-share="baidu">分享到</a>



Expand Down Expand Up @@ -225,7 +232,7 @@ <h3 class="widget-title">近期文章</h3>
<ul>

<li>
<a href="/2015/05/27/Android 异常/">Android 异常(不定期更新</a>
<a href="/2015/05/28/Android 异常(不定期更新)/">Android异常(不定期更新)</a>
</li>

<li>
Expand Down
Loading

0 comments on commit 3de0360

Please sign in to comment.