Android中android.content.res.Resources$NotFoundException的问题

Android Studio主module中引用其他module的xml文件android.content.res.Resources$NotFoundException问题 起因: 主工程中代码 mItemView.setBackgroundResource(R.drawable.selector_key_blue_bg); selector_key_blue_bg.xml内容: <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schem... 阅读详情

最近在调试程序的时候发现一个比较诡异的问题。

E  FATAL EXCEPTION: main
Process: com.eathemeat.justplayer, PID: 22047
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.eathemeat.justplayer/com.eathemeat.justplayer.play.PlayActivity}: android.view.InflateException: Binary XML file line #82 in com.eathemeat.justplayer:layout/activity_play: Binary XML file line #82 in com.eathemeat.justplayer:layout/activity_play: Error inflating class com.eathemeat.widget.slide.NiftySlider
	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:4034)
	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4187)
	at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:103)
	at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:149)
	at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:99)
	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2632)
	at android.os.Handler.dispatchMessage(Handler.java:106)
	at android.os.Looper.loopOnce(Looper.java:222)
	at android.os.Looper.loop(Looper.java:314)
	at android.app.ActivityThread.main(ActivityThread.java:8690)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:565)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081)
Caused by: android.view.InflateException: Binary XML file line #82 in com.eathemeat.justplayer:layout/activity_play: Binary XML file line #82 in com.eathemeat.justplayer:layout/activity_play: Error inflating class com.eathemeat.widget.slide.NiftySlider
Caused by: android.view.InflateException: Binary XML file line #82 in com.eathemeat.justplayer:layout/activity_play: Error inflating class com.eathemeat.widget.slide.NiftySlider
Caused by: java.lang.reflect.InvocationTargetException
	at java.lang.reflect.Constructor.newInstance0(Native Method)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
	at android.view.LayoutInflater.createView(LayoutInflater.java:879)
	at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:1035)
	at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:986)
	at android.view.LayoutInflater.rInflate(LayoutInflater.java:1165)
	at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1126)
	at android.view.LayoutInflater.rInflate(LayoutInflater.java:1168)
	at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1126)
	at android.view.LayoutInflater.inflate(LayoutInflater.java:707)
	at android.view.LayoutInflater.inflate(LayoutInflater.java:545)
	at com.eathemeat.justplayer.databinding.ActivityPlayBinding.inflate(ActivityPlayBinding.java:78)
	at com.eathemeat.justplayer.databinding.ActivityPlayBinding.inflate(ActivityPlayBinding.java:72)
	at com.eathemeat.justplayer.play.PlayActivity.onCreate(PlayActivity.kt:43)
	at android.app.Activity.performCreate(Activity.java:8886)
	at android.app.Activity.performCreate(Activity.java:8851)
	at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1470)
	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:4016)
	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4187)
	at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:103)
	at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:149)
	at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:99)
	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2632)
	at android.os.Handler.dispatchMessage(Handler.java:106)
	at android.os.Looper.loopOnce(Looper.java:222)
	at android.os.Looper.loop(Looper.java:314)
	at android.app.ActivityThread.main(ActivityThread.java:8690)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:565)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081)
Caused by: android.content.res.Resources$NotFoundException: File res/color/default_track_color.xml from ComplexColor resource ID #0x7f050035
	at android.content.res.ResourcesImpl.loadComplexColorForCookie(ResourcesImpl.java:1286)
	at android.content.res.ResourcesImpl.loadComplexColorFromName(ResourcesImpl.java:1112)
	at android.content.res.ResourcesImpl.loadColorStateList(ResourcesImpl.java:1191)
	at android.content.res.Resources.getColorStateList(Resources.java:1195)
	at androidx.core.content.res.ResourcesCompat$Api23Impl.getColorStateList(ResourcesCompat.java:687)
	at androidx.core.content.res.ResourcesCompat.getColorStateList(ResourcesCompat.java:246)
	at androidx.core.content.ContextCompat.getColorStateList(ContextCompat.java:508)
	at androidx.appcompat.content.res.AppCompatResources.getColorStateList(AppCompatResources.java:48)
	at com.eathemeat.widget.slide.AbsSlider.processAttributes(AbsSlide.kt:292)
	at com.eathemeat.widget.slide.AbsSlider.<init>(AbsSlide.kt:243)
	at com.eathemeat.widget.slide.NiftySlider.<init>(NiftySlider.kt:16)
	at com.eathemeat.widget.slide.NiftySlider.<init>(NiftySlider.kt:15)
	at com.eathemeat.widget.slide.NiftySlider.<init>(Unknown Source:11)
	... 30 more
Caused by: java.lang.UnsupportedOperationException: Can't convert value at index 0 to color: type=0x1, theme={InheritanceMap=[id=0x7f10022bcom.eathemeat.justplayer:style/Theme.JustPlayer, id=0x7f10025acom.eathemeat.justplayer:style/Theme.MaterialComponents.DayNight.NoActionBar.Bridge, id=0x7f100275com.eathemeat.justplayer:style/Theme.MaterialComponents.NoActionBar.Bridge, id=0x7f100249com.eathemeat.justplayer:style/Theme.MaterialComponents.Bridge, id=0x7f100066com.eathemeat.justplayer:style/Base.Theme.MaterialComponents.Bridge, id=0x7f100092com.eathemeat.justplayer:style/Base.V14.Theme.MaterialComponents.Bridge, id=0x7f10013ccom.eathemeat.justplayer:style/Platform.MaterialComponents, id=0x7f10020fcom.eathemeat.justplayer:style/Theme.AppCompat, id=0x7f10004bcom.eathemeat.justplayer:style/Base.Theme.AppCompat, id=0x7f1000b8com.eathemeat.justplayer:style/Base.V28.Theme.AppCompat, id=0x7f1000b5com.eathemeat.justplayer:style/Base.V26.Theme.AppCompat, id=0x7f1000afcom.eathemeat.justplayer:style/Base.V23.Theme.AppCompat, id=0x7f1000adcom.eathemeat.justplayer:style/Base.V22.Theme.AppCompat, id=0x7f1000a1com.eathemeat.justplayer:style/Base.V21.Theme.AppCompat, id=0x7f1000bacom.eathemeat.justplayer:style/Base.V7.Theme.AppCompat, id=0x7f10013acom.eathemeat.justplayer:style/Platform.AppCompat, id=0x7f100145com.eathemeat.justplayer:style/Platform.V25.AppCompat, id=0x103022eandroid:style/Theme.Material.NoActionBar, id=0x1030224android:style/Theme.Material, id=0x1030005android:style/Theme], Themes=[com.eathemeat.justplayer:style/Theme.JustPlayer, forced, com.eathemeat.justplayer:style/Theme.AppCompat.Empty, forced, android:style/Theme.DeviceDefault.Light.DarkActionBar, forced]}
	at android.content.res.TypedArray.getColor(TypedArray.java:538)
	at android.content.res.ColorStateList.inflate(ColorStateList.java:366)
	at android.content.res.ColorStateList.createFromXmlInner(ColorStateList.java:296)
	at android.content.res.ResourcesImpl.loadComplexColorForCookie(ResourcesImpl.java:1279)
	... 42 more

原因是:android.content.res.Resources$NotFoundException: File res/color/default_track_color.xml from ComplexColor resource ID #0x7f050035这个资源找不到,这个资源是在一个UI控件的aar中,然后去看了下aar和apk中其实都是有这个xml的文件的。

解决:在网上找了很多的资料,有很多的原因:

  • android问题的(查了下源码,在找xml文件和解析的时候出现错误都会包这个问题)
  • 打包问题,在apk和aar中都有这个文件。排除
  • android版本问题,有说是api24以下有getcolorstatelist的时候会出现这类问题。

搞了很久,还没没有办法从log上定位问题的原因。于是从自身出发,在这文件中查询问题:

试了很多的方法,最终定位问题:

//之前的代码
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:color="@attr/colorPrimary" android:state_enabled="true" />
    <item android:alpha="0.32" android:color="@android:color/black" />
</selector>


//修改后的代码
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:color="?attr/colorPrimary" android:state_enabled="true" />
    <item android:alpha="0.32" android:color="@android:color/black" />
</selector>



根本原因就是@和?的差别。在解析xml的时候由于无法定位主题中

@代表引用资源
 ? 代表引用主题属性

这2者会比较容易搞错。但是在lint中并不会检查这个问题。

Unity新手必看:5分钟搞定TextMeshPro中文乱码,告别小方块(附7000+常用字库) 本文详细介绍了Unity中TextMeshPro中文乱码问题的解决方案,包括快速生成中文字体的步骤和优化技巧。通过使用支持中文的.ttf字体文件和自定义字符集,开发者可以在5分钟内解决TMP显示小方块的问题,提升游戏或应用的文本显示效果。 阅读详情

相关推荐

LAMMPS GCMC模拟保姆级教程:从fix gcmc命令到吸附等温线实战

本文提供LAMMPS GCMC模拟的详细教程,从fix gcmc命令设置到吸附等温线实战,涵盖巨正则蒙特卡洛模拟的全流程。通过MOF-5吸附甲烷的案例,指导用户构建模拟体系、转换化学势与压力、定义GCMC区域,并绘制出版级吸附等温线,助力材料科学研究。

weixin_33724046的博客 626

android.content.res.Resources$NotFoundException

android.content.res.Resources$NotFoundException Resource ID #0x0 com.sh.sdk.shareinstall.helper.GetWebGLInfo.(GetWebGLInfo.java:42) 该异常表示找不到资源ID 。 [解决方案]:出现这个异常的原因有很多,具体原因可以参考Exception Message的内容,建议检查...

陈言必行 -- Unity游戏开发领域优质博主 3874

手把手教你解决CentOS sshd启动报错:从权限问题到目录缺失的全套解决方案

本文提供了一套完整的CentOS SSH服务启动故障排查与修复方案。针对sshd启动报错,从systemd日志分析、sshd -t配置测试入手,详细解决了私钥文件权限过宽(如0644错误)和权限分离目录缺失等典型问题,并附带了扩展排查清单,帮助运维人员系统性地定位和解决连接故障。

weixin_29248611的博客 158

Android报错android.content.res.Resources$NotFoundException

使用开发商提供的代码,开发商只提供了手机版本的代码,当使用平板调试的时候,出现了Resources$NotFoundException的报错,如下: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.arcsoft.arcfacedemo/com.arcsoft.Competition.comm.ConnectBaseActivity}: android.content.res.Resources$NotFou.

Master_Tang的博客 4357

Ubuntu20.04下运行LOAM系列:A-LOAM、LeGO-LOAM、SC-LeGO-LOAM、LIO-SAM 和 LVI-SAM

在我第一篇博文Ubuntu 20.04配置ORB-SLAM2和ORB-SLAM3运行环境+ROS实时运行ORB-SLAM2+Gazebo仿真运行ORB-SLAM2+各种相关库的安装的基础环境下跑通A-LOAM首先已经按照上一篇文章已经安装好了ROS noetic、Eigen3.4.0、OpenCV4.2.0和PCL1.10,A-LOAM在Github的开源地址:https://github.com/HKUST-Aerial-Robotics/A-LOAM。接下来根据代码要求,需要安装Ceres,另外环境的变

zardforever123的博客 3万+

SAP PP实战:MRP Area怎么用?手把手教你按产线、委外供应商拆分物料计划

本文详细解析了SAP PP模块中MRP Area的功能与应用,指导如何按产线、委外供应商拆分物料计划,实现精细化物料需求管理。通过实战案例展示MRP Area在减少计划冲突、提升库存准确率方面的显著效果,为制造业企业提供可落地的解决方案。

weixin_27015733的博客 439

android错误之android.content.res.Resources$NotFoundException:

问题一、  Caused by: android.content.res.Resources$NotFoundException: String resource ID #0x0 如果遇到这个问题,首先考虑以下原因: 你是否在setText()方法中设置了一个int型变量,比如setText(10)。 这样Android系统就会主动去资源文件当中寻找, 但是它不是一

zhusongshuai的专栏 1909

Nginx国密HTTPS实战:SM2双证书部署与TongSuo编译指南

HTTPS作为保障网络通信安全的基石,其核心在于SSL/TLS协议与公钥基础设施(PKI)。它通过非对称加密实现身份认证与密钥交换,再结合对称加密确保数据传输的机密性与完整性。在金融、政务等对自主可控有严格要求的领域,采用符合国家密码管理局标准的国密算法(SM2/SM3/SM4)替代国际通用算法(如RSA/SHA-256/AES),已成为满足安全合规要求的关键技术路径。国密SSL不仅是一套算法替换,更涉及从底层密码库到上层应用服务的完整技术栈改造。其核心价值在于实现密码技术的自主可控,提升特定场景下的安全防

weixin_29323365的博客 530

解决android.content.res.ResourcesNotFoundException

遇到ResourcesNotFoundException的问题,在编译的时候不会有问题,而在运行的时候会报错,在网上找了几种解决的方法,尝试了一下,可以解决: 1、今天遇到类似这样问题,后来在找到解决方案,把AndroidManifest.xml里面的版本改为8(我原来的是10),问题解决了,原因是这样的:主要是原来的那个工程占用现在的这个虚拟机,不能正常加载现在的这个工程. ...

Eric的博客 3045

构建可编程记忆系统:OpenClaw-SuperMemory本地部署与智能知识管理实战

在信息过载的时代,高效的知识管理与智能检索成为技术从业者的核心需求。向量数据库与嵌入模型技术通过将文本转化为高维向量,实现了基于语义相似度的智能搜索,突破了传统关键词匹配的局限。这项技术的核心价值在于将静态存储的信息转化为可动态查询和计算的知识资产,极大地提升了信息调用的准确性和效率。其应用场景广泛,从个人笔记管理、对话历史归档到企业知识库构建都能发挥关键作用。本文聚焦于开源项目OpenClaw-SuperMemory,它正是基于这一技术栈,通过本地化部署实现了可编程记忆系统的构建。项目集成了ChromaD

weixin_42525482的博客 322

SAP 打印输出中 `#` 字符替代日文汉字的根本原因与全面解决方案

只要认清设备类型 / 字符集 / 字体三角关系,并合理利用PDFUCSWINCF或 UPE + URDT,LP01里那些恼人的就会彻底消失,日文汉字将在纸面与 PDF 中如预览一样完美呈现。

2007 年 ~ 2025 年,深耕 SAP 技术 18 年 845

android.content.res.Resources$NotFoundException 问题解决方案

问题描述 Process: com.jason.morelistitem, PID: 15181 android.content.res.Resources$NotFoundException: String resource ID #0x5 at android.content.res.Resources.getText(Resources.java:367) at android.widge...

大山喵写博客的地方 3609

Python爬虫实战:使用最新技术抓取采购网招标公告信息

本文将详细介绍如何使用Python最新爬虫技术构建一个高效的采购网招标公告信息抓取系统。我们将从爬虫基础概念讲起,逐步深入到高级技巧,包括异步处理、反爬虫对策、数据解析与存储等,并提供完整的代码实现。本文旨在为读者提供一套完整的网络数据采集解决方案,适用于各类政府采购平台和商业招标网站。网络爬虫(Web Crawler)是一种自动抓取互联网信息的程序或脚本,它们按照一定的规则,自动地浏览万维网并提取所需数据。在现代商业环境中,爬虫技术广泛应用于价格监控、竞争情报收集、市场研究等领域。

2201_76125261的博客 1634

Unity安卓原生交互android.content.res.Resources$NotFoundException: String resource问题

原生加载UnityActivatey的时候logcat人有如下错误提示: android.content.res.Resources$NotFoundException: String resource ID #0x0 解决方法: 把Unity导出AS工程中的 /XXX(工程名)/src/main/res/values/strings.xml文件的 <string name="game_v...

月儿圆 1862

WINCC7.3破解文件

WINCC7.3硬件够破解文件,有需要的下载!WINCC7.3硬件够破解文件,有需要的下载!

RU DOS版、EFI版32bit/64bit BIOS常用工具

DOS版、EFI版的RU工具,可用来查看IO、MEM、PCI、SMBIOS等资源。亲测在EFI SHELL下可用。

Android 开发问题:android.content.res.Resources$NotFoundException: Resource ID

Android 开发问题:android.content.res.Resources$NotFoundException: Resource ID

weixin_52173250的博客 448

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

Android开发遇到的问题————android.content.res.Resources$NotFoundException

E/AndroidRuntime: FATAL EXCEPTION: main Process: com.example.gamermanagement, PID: 4985 android.content.res.Resources$NotFoundException: Resource ID #0x7f060063 at android.content.res...

qq_41398448的博客 3176

IMSL CNL 7.0.0 (x86-64)Crack

IMSL CNL 7.0.0 (x86-64)Crack intel的算法库破解文件,这是C++版本的破解文件

[解决问题]android.content.res.Resources$NotFoundException

android.content.res.Resources$NotFoundException: String resource ID #0x1

洗棉花糖的浣熊的博客 1666

有图片资源,但是报 android.content.res.Resources$NotFoundException 的问题

有图片资源,但是报 android.content.res.Resources$NotFoundException 的问题,修改 buildToolsVersion 解决。

KK的博客 2693

[Android][Fatal Exception] android.content.res.Resources$NotFoundException 问题及解决方法

问题1描述 读取sharePreferences的时候遇到了一个EXCEPTION,具体如下: 问题1解决方法 如上图所示,在R.java里找到这个ID对应的资源名,发现原来是我代码中的数据类型写错了,期待的是一个Int,但是我给的是一个String,代码及修改如下: int defaultValue = getResources().getInteger(R.st

浪也不争春 1150

问题 android.content.res.Resources$NotFoundException: String resource ID #0xfffffffa

android.content.res.Resources$NotFoundException: String resource ID #0xfffffffa at android.content.res.Resources.getText(Resources.java:367) at android.widget.Toast.makeText(Toast.java:290) at com.

u010272905的博客 5639

【具体问题】android.content.res.Resources$NotFoundException: String resource ID

问题: private int currentPosition; tv_current_position.setText(currentPosition); 给TextView设置值的时候出现 android.content.res.Resources$NotFoundException: String resource ID ... ... 解决: tv_current_posi...

qq_36478274的博客 250

android.content.res.Resources$NotFoundException: Resource ID XXX问题解决

最近遇到项目报这个错误,但是资源却是存在的,在网上找了资料,clean,类型转换,工程占用,等等方法都试过了,均不能解决,最后发现,原来是这个原因。

你好小C的博客 3989

Android问题解决记录—android.content.res.Resources$NotFoundException: Unable to find resource ID

问题描述android.content.res.Resources$NotFoundException: Unable to find resource ID #0xffffffff 问题分析根据错误日志我们可以看出这里出现了资源未找到异常,根据以往的经验,可能是ID引用出现问题,但是这个错误日志并没有告诉我们问题出现的具体地方,所以是比较难找的一种。 后来网上搜索了一下,在stackflow上

不悔的青春 8443

Android中出现android.content.res.Resources$NotFoundException: Resource ID #0x0问题

参考:https://blog.csdn.net/qq_36317441/article/details/78521447博客,解决了我的问题,在这里记录一下。 private void showDialogCustom(){ AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this); ...

qq_41853047的博客 1208

Android 常见问题之 android.content.res.Resources$NotFoundException: Resource ID 解决方案

前几天发现一个问题,项目配置默认横屏,打开相机的时候,会出现闪退的现像。复现问题并打LOG。 从LOG中看出, 09-13 09:32:02.202 E/AndroidRuntime(11327): Process: org.codeaurora.snapcam, PID: 11327 09-13 09:32:02.202 E/AndroidRuntime(11327): java.lang

若然的专栏 3万+

关于android.content.res.Resources$NotFoundException: Resource is not a Drawable 问题的解决办法

问题描述:做了一个安卓TV的应用,由于涉及到底层API的调用,所以先在Eclipse中编译好可执行的代码,然后再添加上底层API,最后在安卓源码中编译。但是编译安装后出现如题中所示的问题。解决过程: 1.在查找解决方案的过程中,发现eclipse编译的安装包是6M,安卓源码编译的是1点多M,所以猜想是不是资源文件没有打包到安装包中。 2.尝试将各个资源改成@null,最后可以显示主界面,但是执行

凌云子09的专栏 4933
上一篇: Android中矢量图记录一二
下一篇: Android中链接带符号库 ld.lld: error: undefined symbol
PeterXi
博客等级 码龄15年 37粉丝 29原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值