FAQ:  Android app 编译好后安装到手机,运行时闪退,报如下错误:

java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{io.grpc.helloworldexample/io.grpc.helloworldexample.HelloworldActivity}: java.lang.ClassNotFoundException: Didn't find class "io.grpc.helloworldexample.HelloworldActivity" on path: DexPathList[[zip file "/data/app/io.grpc.helloworldexample-aHJfGmXKi-KoAnqDIRZHhQ==/base.apk"],nativeLibraryDirectories=[/data/app/io.grpc.helloworldexample-aHJfGmXKi-KoAnqDIRZHhQ==/lib/arm64, /system/lib64, /vendor/lib64]]

问题原因:

重复拷贝工程,并且重名工程都在as中打开过,导致as产生混淆,找不到相应类:

解决办法:

直接禁用Instant run, 这个效果最直接

disable Instant Run Go to File -> Settings -> Build,Execution, Deployment -> Instant Run -> Uncheck the checkbox for instant run. Run your app once and this apk file work properly..

试了下下面其他的办法,对GRPC上的这个问题解决没有效果,只能禁用即时编译,看来这个即时编译就是一个摆设,不实用,毛病问题太多!!!


其他的解决办法(供参考):

DELETE THAT FOLDER .gradle.

deleted "build" folder under "app" folder.

Change the application name in AndroidManifest to full path
Clean Project
Rebuild Project
Build APK

My problem solved using use multi dex:

android {
defaultConfig {

// Enabling multidex support.
multiDexEnabled true
}
...
}
dependencies
{
compile 'com.android.support:multidex:1.0.0'
}

// in AndroidManifest.xml:
<application
android:name="android.support.multidex.MultiDexApplication" >
...
</application>

public class MyApplication extends MultiDexApplication

Make sure this Diable preDexLibraries

In your app module .gradle file

android {
dexOptions {
  preDexLibraries false
 }

}

Caused by: java.lang.ClassNotFoundException: Didn't find class "io.grpc.helloworldexample.HelloworldActivity" on path: DexPathList的更多相关文章

  1. 项目报错:Caused by: java.lang.ClassNotFoundException: Didn't find class "..."on path: DexPathList

    项目报错: Caused by: java.lang.ClassNotFoundException: Didn't find class "com.eshore.njb.MyApplicat ...

  2. 【异常】Caused by: java.lang.ClassNotFoundException: org.springframework.dao.DataIntegrityViolationException

    Caused by: java.lang.ClassNotFoundException: org.springframework.dao.DataIntegrityViolationException ...

  3. android 自定义View Caused by: java.lang.ClassNotFoundException: Didn't find class

    在android studio中, 自定义View 时,出现 Caused by: java.lang.ClassNotFoundException: Didn't find class 在查看包名和 ...

  4. Caused by: java.lang.ClassNotFoundException: org.apache.commons.io.FileUtils

    1.错误叙述性说明 警告: Could not create JarEntryRevision for [jar:file:/D:/MyEclipse/apache-tomcat-7.0.53/web ...

  5. Caused by: java.lang.ClassNotFoundException: com/sun/tools/internal/xjc/api/XJC

    Caused by: java.lang.ClassNotFoundException: com/sun/tools/internal/xjc/api/XJC 缺少com/sun/tools/inte ...

  6. Caused by: java.lang.ClassNotFoundException: javassist.ClassPool

    1.错误原因 usage: java org.apache.catalina.startup.Catalina [ -config {pathname} ] [ -nonaming ] { -help ...

  7. Caused by: java.lang.ClassNotFoundException: com.mchange.v2.c3p0.ComboPooledDataSource

    1.错误描写叙述 usage: java org.apache.catalina.startup.Catalina [ -config {pathname} ] [ -nonaming ] { -he ...

  8. 生成HFile文件后倒入数据出现Caused by: java.lang.ClassNotFoundException: org.apache.hadoop.hbase.filter.Filter

    数据导入的时候出现: at java.lang.Class.getDeclaredMethods0(Native Method) at java.lang.Class.privateGetDeclar ...

  9. Selenium 出现: Caused by: java.lang.ClassNotFoundException: org.w3c.dom.ElementTraversal

    webDriver 运行的时候出现: Caused by: java.lang.ClassNotFoundException: org.w3c.dom.ElementTraversal 解决办法: 只 ...

随机推荐

  1. h5中placeholder样式

    <!DOCTYPE html> <html> <head> <title>placeholder样式demo</title> <sty ...

  2. jquery获取浏览器URL参数

    getRequestParams:function(param){ var reg = new RegExp("(^|&)" + param + "=([^&am ...

  3. 开启gtid导入报错

    导入报错 [root@redis02 data]# mysql -u root -p < ht.sqlEnter password: ERROR 1840 (HY000) at line 24: ...

  4. 【原创】大数据基础之Flume(2)kudu sink

    kudu中的flume sink代码路径: https://github.com/apache/kudu/tree/master/java/kudu-flume-sink kudu-flume-sin ...

  5. 【进阶1-4期】JavaScript深入之带你走进内存机制(转)

    这是我在公众号(高级前端进阶)看到的文章,现在做笔记 https://mp.weixin.qq.com/s/yK4DPKhkmkiroasWJMrJcw 阅读笔记 JS内存空间分为栈(stack).堆 ...

  6. 手把手教你React Native 实战之开山篇《一》

    先说一下我为什么学习RN 18年3月29号,随着自己内心的欲望和冲动,任务交接了一下,正式离开一家医疗公司.第二天就入职了这之前已经找好的公司,由于自己对代码浓厚的热情,自己终于也不再带团队.正好有充 ...

  7. swift 实践- 01 -- UItableView的简单使用

    import UIKit class ViewController: UIViewController ,UITableViewDelegate,UITableViewDataSource{ over ...

  8. 使用Node.js+Hexo+Github搭建个人博客(续)

    一.写在前面 在我的上一篇博客<使用Nodejs+Hexo+Github搭建个人博客>中,已经介绍了如何使用 Hexo 在 Github Pages 上搭建一个简单的个人博客.该篇博文将在 ...

  9. Confluence 6 确定一个生产系统备份方案

    Atlassian 推荐创建一个可选的数据库备份方案: 使用你数据库提供的备份和恢复工具 为了避免数据不完整和备份中断,我们推荐你在备份和恢复 Confluence 数据库的时候关闭 Confluen ...

  10. sticky footer 模板

    http://www.w3cplus.com/blog/tags/136.html http://www.w3cplus.com/css/css-sticky-foot-at-bottom-of-th ...