• 具体错误
2021-11-01 20:03:17.567 14095-14095/com.serenegiant.usbcameratest E/AndroidRuntime: FATAL EXCEPTION: mainProcess: com.serenegiant.usbcameratest, PID: 14095java.lang.RuntimeException: Unable to start activity ComponentInfo{com.serenegiant.usbcameratest/com.serenegiant.usbcameratest.MainActivity}: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3483)at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3655)at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:85)at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2108)at android.os.Handler.dispatchMessage(Handler.java:106)at android.os.Looper.loop(Looper.java:236)at android.app.ActivityThread.main(ActivityThread.java:7879)at java.lang.reflect.Method.invoke(Native Method)at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:656)at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:967)Caused by: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.at androidx.appcompat.app.AppCompatDelegateImpl.createSubDecor(AppCompatDelegateImpl.java:696)at androidx.appcompat.app.AppCompatDelegateImpl.ensureSubDecor(AppCompatDelegateImpl.java:659)at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:552)at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:161)at com.serenegiant.usbcameratest.MainActivity.onCreate(MainActivity.java:63)
  • 解决办法一

由继承自AppCompatActivity改为继承自Activity

  • 解决办法二

第一步:在当前应用的build.gradle,添加红色加粗这两句:

dependencies {

    compile 'com.android.support:design:25.0.0'
    compile 'com.android.support.constraint:constraint-layout:1.0.0-beta5'

}
第二步:在对应的activity中添加红色加粗这一句:

<activity android:name="net.quantum6.MainActivity"
    android:windowSoftInputMode="stateHidden|adjustPan"
    android:theme="@style/AppThemeQuantum6"
    android:screenOrientation="portrait"
    >
第三步:在style.xml添加红色加粗这三句:

<style name="AppThemeQuantum6" parent="Theme.AppCompat.Light.DarkActionBar">
    <!-- Customize your theme here. -->
</style>

You need to use a Theme.AppCompat theme (or descendant) with this activity相关推荐

  1. You need to use a Theme.AppCompat theme (or descendant) with this activity解决方法

    You need to use a Theme.AppCompat theme (or descendant) with this activity解决方法 参考文章: (1)You need to ...

  2. 【错误记录】Android 应用运行报错 ( You need to use a Theme.AppCompat theme (or descendant) with this activity. )

    文章目录 一.报错信息 二.解决方案 一.报错信息 运行 Android 应用时 , 报错 ; 报错信息如下 : 2021-08-04 21:04:12.067 26338-26338/com.exa ...

  3. 关于新版SDK报错You need to use a Theme.AppCompat theme的两种解决办法 - 转

    android的一个小问题: Caused by: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme ( ...

  4. Caused by: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant)

    Caused by: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant)  ...

  5. Android之You need to use a Theme.AppCompat theme (or descendant) with this activity.

    1 问题 点击activity的时候,崩溃日志如下 You need to use a Theme.AppCompat theme (or descendant) with this activity ...

  6. Android中SlidingDrawer开发报错You need to use a Theme.AppCompat theme (or descendant) with this activity.

    Android抽屉开发报错You need to use a Theme.AppCompat theme (or descendant) with this activity. 方法1: 创建的act ...

  7. java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this a

    微信支付它给的WXPayEntryActivity主题改错了 java.lang.RuntimeException: Unable to start activity ComponentInfo{包名 ...

  8. You need to use a Theme.AppCompat theme (or descendant) with this activity. 完美解决

    先看一条错误信息: Caused by: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or de ...

  9. 【小坑】Android 实现对话框会报错 (You need to use a Theme.AppCompat theme (or descendant) with this activity)

    效果演示 有的时候,我们想Activity以小窗口的形式展示. 其实只需要添加上这么一行就可以了. android:theme="@style/Theme.AppCompat.Light.D ...

  10. Caused by: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descend

    android 开发中碰到的错误,之前开发也有碰到,今天记录下 在我们新创建的项目中或者有修改相关的配置文件,最容易出现这个问题,他的意思很简单就是你当前使用的皮肤theme不是我需要的,从错误可以看 ...

最新文章

  1. mysql分析表增删改统计_MySQL增删改查|附思维导图
  2. Linux下gcc编译生成动态链接库*.so文件并调用它
  3. android根据拍摄url获取格式,Android如何通过URI获取文件路径示例代码
  4. 两种方法求解 正数数组中 两个数相减 的最大值
  5. Myeclipse学习总结(2)——MyEclipse快捷键大全
  6. Java String简单知识点总结
  7. M1芯片mac好用吗?来听听ta们是怎么说的
  8. 我对八种常见数据结构的理解
  9. CSDN 迷你博客错误
  10. android数据库工具 SQLiteSpy下载 sharePlus.Sqlite下载 DB.Browser.for.SQLite下载
  11. 如何设置word的默认输入法——搜狗输入法
  12. 一程序员辞职开发赌博软件,2年涉案4千万被抓
  13. EXCEL将网段地址分解成明细地址
  14. Mac 卸载重装 brew
  15. 最新最全python镜像源-(转)
  16. 基于STM32F103单片机的智能药盒喂食器智能插座系统
  17. Mac使用技巧之Finder的个人收藏
  18. 五年级计算机教案及反思,2014-2015学年度下册五年级信息技术教案(有教学反思).doc...
  19. 学习Java——字符串池、常量池
  20. 聚合支付的风控风险!!!

热门文章

  1. 使用匿名内部类排序对象
  2. MapReduce Shuffle详解
  3. 最大公约数(欧几里得算法)
  4. mem考试能用计算机吗,东华大学计算机学院MEM难考吗
  5. mysql 5.1主从_MySQL5.1版本的主从复制搭建 | 学步园
  6. java编译前端_compiler Java实现的编译器前端(一直到中间代码生成)其中使用了JFLEX及CUP做Lex program /解释器 238万源代码下载- www.pudn.com...
  7. android发送短信界面,android调用系统发送短信 和 已发送短信界面
  8. linux 下xhprof的安装和使用
  9. linux 查看端口
  10. 简单记录fastDFS安装