当前位置: 首页 > news >正文

安卓学习中遇到的问题【bug】

安卓学习中遇到的问题

1Gradle下载慢怎么办?

Gradle下载慢怎么办?

distributionUrl=https://mirrors.cloud.tencent.com/gradle/gradle-7.5-bin.zip

2 Could not resolve all files for configuration ‘:classpath‘. > Could not resolve com.android.tools

Could not resolve all files for configuration ‘:classpath‘. > Could not resolve com.android.tools

https://blog.csdn.net/AgonyAngela/article/details/138075256

在这里插入图片描述

3 sdk下载慢的解决办法

sdk下载慢的解决办法

4 为什么android studio代码提示很慢

为什么android studio代码提示很慢

缓解修复Android Studio卡顿,Kotlin代码提示慢

5 Android Studio开发遇到爆红@layout/activity_main does not contain a declaration with id `xx

Android Studio开发遇到爆红`@layout/activity_main` does not contain a declaration with id `xx

Alt + Enter,选择第二个

× suppress MissingInflatedld with an annotation

6 Android开发中Button背景颜色不能修改问题及解决方法

Android开发中Button背景颜色不能修改问题及解决方法

AndroidStudio无法改变Button背景颜色解决办法

把其中values/themes.xml文件

	<style name="Theme.HelloWorld" parent="Theme.MaterialComponents.DayNight.DarkActionBar">

parent后面的值改为Theme.MaterialComponents.DayNight.NoActionBar.Bridge

    <style name="Theme.HelloWorld" parent="Theme.MaterialComponents.DayNight.NoActionBar.Bridge">

在这里插入图片描述

7 Android Studio Error: Activity class {com.example/com.example.MainActivity} does not exist.

Android Studio Error: Activity class {com.example/com.example.MainActivity} does not exist.原因及解决办法

https://blog.csdn.net/qq_43525355/article/details/88057367

8 android 运行时改代码吗,Android Studio 编译运行时安装的是上次打包的代码而不是修改后的代码…

android 运行时改代码吗,Android Studio 编译运行时安装的是上次打包的代码而不是修改后的代码…

https://blog.csdn.net/weixin_39845241/article/details/117551808

https://blog.csdn.net/niubitianping/article/details/117779567

9 FAILURE: Build failed with an exception.

项目目录有中文字符

FAILURE: Build failed with an exception.

  • Where:
    Build file ‘D:\Desktop\���ļ�\HelloWorld\app\build.gradle’ line: 2

  • What went wrong:
    An exception occurred applying plugin request [id: ‘com.android.application’]

Failed to apply plugin ‘com.android.internal.application’.
Your project path contains non-ASCII characters. This will most likely cause the build to fail on Windows. Please move your project to a different directory. See http://b.android.com/95744 for details. This warning can be disabled by adding the line ‘android.overridePathCheck=true’ to gradle.properties file in the project directory.

10 Error while waiting for device: Nexus 6 API 34 is already running.

Error while waiting for device: Nexus 6 API 34 is already running. If that is not the case, delete C:\Users\lenovo.android\avd\Nexus_6_API_34.avd*.lock and try again.
远程主机强迫关闭了一个现有的连接。

11 A problem occurred evaluating project ‘:app’.

A problem occurred evaluating project ‘:app’. > Build was configured to prefer settings repositories over project repositories but repository ‘Google’ was added by build file ‘app\build.gradle’

依赖第三方jar包 glide

在这里插入图片描述

setting.grade中已经有了

repositories {google()mavenCentral()
}

在这里插入图片描述
只需在build.grade(:app)中配置就好了。

dependencies {implementation 'com.github.bumptech.glide:glide:4.16.0
}

在这里插入图片描述

12 E/GlideExecutor: Request threw uncaught throwable

E/GlideExecutor: Request threw uncaught throwable
java.lang.SecurityException: Permission denied (missing INTERNET permission?)

没有网络请求的权限

在AndroidManifest.xml加入

 <uses-permission android:name="android.permission.INTERNET"/>

在这里插入图片描述

13 mWvMain.loadUrl(“javascript:alert('hello)”);为什么没弹出

mWvMain.loadUrl(“javascript:alert('hello)”);为什么没弹出

Android webview调用js代码无效 webView.loadUrl(“javascript:alert(‘hello’)”)

14 Android Toast.setGravity()失效,无作用原因及其修改方法!

Android Toast.setGravity()失效,无作用原因及其修改方法!

//在30+的版本不起作用
//E/Toast: setGravity() shouldn’t be called on text toasts, the values won’t be used
toastCenter.setGravity(Gravity.CENTER, 0, 0);

15 为什么没有这个类AlterDialog

import androidx.appcompat.app.AlertDialog;AlertDialog.Builder builder=new AlertDialog.Builder(DialogActivity.this);

解决Android v4、v7包导入标红问题import android.support.v4.app.ActivityCompat;import android.support.v7.app

16 Installation did not succeed. The application could not be installed: INSTALL_PARSE_FAILED_MANIFEST_MALFORMED

Installation did not succeed.
The application could not be installed: INSTALL_PARSE_FAILED_MANIFEST_MALFORMED

List of apks:
[0] ‘E:\AndroidStudioProjects\HelloWorld\app\build\intermediates\apk\debug\app-debug.apk’
Installation failed due to: ‘INSTALL_PARSE_FAILED_MANIFEST_MALFORMED: Failed parse during installPackageLI: /data/app/vmdl707213382.tmp/base.apk (at Binary XML file line #80): Invalid taskAffinity name asdfghjkdfghj in package com.example.helloworld: must have at least one ‘.’ separator’
Retry
Failed to launch an application on all devices

在这里插入图片描述

17 新版本Fragment的API

这个是新版本的import androidx.fragment.app.Fragment;

import androidx.fragment.app.Fragment;
public class AFragment extends Fragment {
public class BFragment extends Fragment {getSupportFragmentManager().beginTransaction().replace(R.id.fl_container, bFragment).commit();
getSupportFragmentManager().beginTransaction().add(R.id.fl_container, aFragment).commitAllowingStateLoss();

这个是被废弃的import android.app.Fragment;

import android.app.Fragment;
public class AFragment extends Fragment {
public class BFragment extends Fragment {getFragmentManager().beginTransaction().replace(R.id.fl_container, bFragment).commit();
getFragmentManager().beginTransaction().add(R.id.fl_container, aFragment).commitAllowingStateLoss();

18 @layout/activity event does not contain a declaration with id btn event

@layout/activity event does not contain a declaration with id btn event

过一会就不报错了

    @SuppressLint("MissingInflatedId")

19 外部文件权限

fileNotfoundException: /storage/enulated/0/skypan/test.txt (pernission denied)

AndroidManifest.xml

    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

如果是Android22+,还需要在
MainActivity

        ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, 1);

相关文章:

安卓学习中遇到的问题【bug】

安卓学习中遇到的问题 1Gradle下载慢怎么办&#xff1f; Gradle下载慢怎么办&#xff1f; distributionUrlhttps://mirrors.cloud.tencent.com/gradle/gradle-7.5-bin.zip 2 Could not resolve all files for configuration ‘:classpath‘. &#xff1e; Could not resolv…...

【日常记录】【CSS】display:inline 的样式截断

文章目录 1. 案例2. css属性&#xff1a;box-decoration-break参考地址 1. 案例 现在有一篇文章&#xff0c;某些句子&#xff0c;是要被标记的&#xff0c;加一些css 让他突出一下 可以看到&#xff0c;在最后&#xff0c;断开了&#xff0c;那如若要让 断开哪里的样式 和 开始…...

数据库系统安全

数据库安全威胁 数据库作为信息系统中的核心组成部分&#xff0c;存储和管理着大量敏感和关键的数据&#xff0c;成为网络攻击者的主要目标之一。以下是常见的数据库安全威胁及其详细描述&#xff1a; 一、常见数据库安全威胁 SQL注入攻击&#xff08;SQL Injection&#xff…...

Qt MV架构-代理模型

一、基本概念 代理模型可以将一个模型中的数据进行排序或者过滤&#xff0c;然后提供给视图进行显示。 Qt中提供了QSortFilterProxyModel作为标准的代理模型来完成模型中数据的排序和过滤。 要使用一个代理模型&#xff0c;则只需要为其设置源模型&#xff0c;然后再视图中使…...

WebSocket实现群聊功能、房间隔离

引用WebSocket相关依赖 <dependency><groupId>javax.websocket</groupId><artifactId>javax.websocket-api</artifactId><version>1.1</version></dependency><dependency><groupId>org.springframework</grou…...

顶顶通呼叫中心中间件实现随时启动和停止质检(mod_cti基于FreeSWITCH)

文章目录 前言联系我们拨号方案启动停止ASR执行FreeSWITCH 命令接口启动ASR接口停止ASR接口 通知配置cti.json配置质检结果写入数据库 前言 顶顶通呼叫中心中间件的实时质检功能是由两个模块组成&#xff1a;mod_asr 和 mod_qc。 mod_asr&#xff1a;负责调用ASR将用户们在通…...

基于conda包的环境创建、激活、管理与删除

Anaconda是一个免费、易于安装的包管理器、环境管理器和 Python 发行版&#xff0c;支持平台包括Windows、macOS 和 Linux。下载安装地址&#xff1a;Download Anaconda Distribution | Anaconda 很多不同的项目可能需要使用不同的环境。例如某个项目需要使用pytorch1.6&#x…...

处理线程安全的列表CopyOnWriteArrayList 和Collections.synchronizedList

ConcurrentModificationException 是 Java 中的一种异常&#xff0c;用于指示在迭代集合时&#xff0c;该集合的结构发生了并发修改。 在 Java 中&#xff0c;许多集合类&#xff08;如 ArrayList, HashMap 等&#xff09;都不是线程安全的。如果一个线程在迭代集合的同时&…...

技术成神之路:设计模式(六)策略模式

1.介绍 策略模式&#xff08;Strategy Pattern&#xff09;是一种行为型设计模式&#xff0c;它定义了一系列算法&#xff0c;封装每一个算法&#xff0c;并使它们可以相互替换。策略模式使得算法的变化独立于使用算法的客户端。 2.主要作用 策略模式的主要作用是将算法或行为…...

华为OD机考题(HJ90 合法IP)

前言 经过前期的数据结构和算法学习&#xff0c;开始以OD机考题作为练习题&#xff0c;继续加强下熟练程度。 描述 IPV4地址可以用一个32位无符号整数来表示&#xff0c;一般用点分方式来显示&#xff0c;点将IP地址分成4个部分&#xff0c;每个部分为8位&#xff0c;表示成…...

值得关注的数据资产入表

不错的讲解视频&#xff0c;来自&#xff1a;第122期-杜海博士-《数据资源入表及数据资产化》-大数据百家讲坛-厦门大学数据库实验室主办第122期-杜海博士-《数据资源入表及数据资产化》-大数据百家讲坛-厦门大学数据库实验室主办-20240708_哔哩哔哩_bilibili...

Postman API性能测试:解锁高级技巧的宝库

&#x1f680; Postman API性能测试&#xff1a;解锁高级技巧的宝库 在API开发和测试过程中&#xff0c;性能测试是确保API稳定性和可靠性的关键环节。Postman作为API测试的强大工具&#xff0c;提供了多种性能测试功能和高级技巧&#xff0c;帮助开发者深入分析API的性能表现…...

stm32中断详解

stm32中断详解 文章目录 stm32中断详解1.什么是中断&#xff1f;1.STM32中断系统特点2.中断处理流程3.中断配置与使用 2.AFIO寄存器3.NVIC寄存器3.中断分组、抢占优先级和响应优先级1. 中断分组2. 抢占优先级3. 响应优先级4.配置与应用 4.中断服务函数5.配置中断流程1.配置外设…...

【LeetCode】最小栈

目录 一、题目二、解法完整代码 一、题目 设计一个支持 push &#xff0c;pop &#xff0c;top 操作&#xff0c;并能在常数时间内检索到最小元素的栈。 实现 MinStack 类: MinStack() 初始化堆栈对象。 void push(int val) 将元素val推入堆栈。 void pop() 删除堆栈顶部的元…...

链接追踪系列-09.spring cloud项目整合elk显示业务日志

准备工作&#xff1a; 参看本系列之前篇&#xff1a;服务器安装elastic search 本机docker启动的kibana-tencent 使用本机安装的logstash。。。 本微服务实现的logstash配置如下&#xff1a; 使用腾讯云redis 启动本机mysql 启动本机docker 启动nacos,微服务依赖它作为…...

老年生活照护实训室:让养老护理更个性化

本文探讨了老年生活照护实训室在实现养老护理个性化方面的重要作用。通过分析其提供的实践环境、专业培训、模拟案例和评估机制&#xff0c;阐述了如何培养护理人员的个性化服务能力&#xff0c;以满足老年人多样化的需求&#xff0c;提高养老护理的质量和满意度。 在老龄化社会…...

c++课后作业

把字符串转换为整数 int main() {char pn[21];cout << "请输入一个由数字组成的字符串&#xff1a; ";cin >> pn;int last 0;int res[10];int j strlen(pn);int idx 2;cout << "请选择&#xff08;2-二进制&#xff0c;10-十进制&#xf…...

SpringBoot+Vue实现简单的文件上传(txt篇)

SpringBootVue实现简单的文件上传 1 环境 SpringBoot 3.2.1&#xff0c;Vue 2&#xff0c;ElementUI 2 页面 3 效果&#xff1a;只能上传txt文件且大小限制为2M&#xff0c;选择文件后自动上传。 4 前端代码 <template><div class"container"><el-…...

LLMs之RAG:GraphRAG(本质是名词Knowledge Graph/Microsoft微软发布)的简介、安装和使用方法、案例应用之详细攻略

LLMs之RAG&#xff1a;GraphRAG(本质是名词Knowledge Graph/Microsoft微软发布)的简介、安装和使用方法、案例应用之详细攻略 导读&#xff1a;2024年7月3日&#xff0c;微软正式开源发布GraphRAG。GraphRAG可以提高大型语言模型在私有数据集上的推理能力。 背景痛点&#xff1…...

Linux 之前的 Unix 桌面沉浮启示录

It takes more than open source, it takes open standards and consensus 仅仅开源还不足以实现开放&#xff0c;还需开放标准和建立共识 Steven J. Vaughan-Nichols Sat 27 Jan 2024 // 12:33 UTC 现在&#xff0c;由于有了安卓和 ChromeOS&#xff0c;Linux 已成为重要的终端…...

3.3.1_1 检错编码(奇偶校验码)

从这节课开始&#xff0c;我们会探讨数据链路层的差错控制功能&#xff0c;差错控制功能的主要目标是要发现并且解决一个帧内部的位错误&#xff0c;我们需要使用特殊的编码技术去发现帧内部的位错误&#xff0c;当我们发现位错误之后&#xff0c;通常来说有两种解决方案。第一…...

Linux相关概念和易错知识点(42)(TCP的连接管理、可靠性、面临复杂网络的处理)

目录 1.TCP的连接管理机制&#xff08;1&#xff09;三次握手①握手过程②对握手过程的理解 &#xff08;2&#xff09;四次挥手&#xff08;3&#xff09;握手和挥手的触发&#xff08;4&#xff09;状态切换①挥手过程中状态的切换②握手过程中状态的切换 2.TCP的可靠性&…...

LeetCode - 394. 字符串解码

题目 394. 字符串解码 - 力扣&#xff08;LeetCode&#xff09; 思路 使用两个栈&#xff1a;一个存储重复次数&#xff0c;一个存储字符串 遍历输入字符串&#xff1a; 数字处理&#xff1a;遇到数字时&#xff0c;累积计算重复次数左括号处理&#xff1a;保存当前状态&a…...

oracle与MySQL数据库之间数据同步的技术要点

Oracle与MySQL数据库之间的数据同步是一个涉及多个技术要点的复杂任务。由于Oracle和MySQL的架构差异&#xff0c;它们的数据同步要求既要保持数据的准确性和一致性&#xff0c;又要处理好性能问题。以下是一些主要的技术要点&#xff1a; 数据结构差异 数据类型差异&#xff…...

2025 后端自学UNIAPP【项目实战:旅游项目】6、我的收藏页面

代码框架视图 1、先添加一个获取收藏景点的列表请求 【在文件my_api.js文件中添加】 // 引入公共的请求封装 import http from ./my_http.js// 登录接口&#xff08;适配服务端返回 Token&#xff09; export const login async (code, avatar) > {const res await http…...

NLP学习路线图(二十三):长短期记忆网络(LSTM)

在自然语言处理(NLP)领域,我们时刻面临着处理序列数据的核心挑战。无论是理解句子的结构、分析文本的情感,还是实现语言的翻译,都需要模型能够捕捉词语之间依时序产生的复杂依赖关系。传统的神经网络结构在处理这种序列依赖时显得力不从心,而循环神经网络(RNN) 曾被视为…...

3403. 从盒子中找出字典序最大的字符串 I

3403. 从盒子中找出字典序最大的字符串 I 题目链接&#xff1a;3403. 从盒子中找出字典序最大的字符串 I 代码如下&#xff1a; class Solution { public:string answerString(string word, int numFriends) {if (numFriends 1) {return word;}string res;for (int i 0;i &…...

【碎碎念】宝可梦 Mesh GO : 基于MESH网络的口袋妖怪 宝可梦GO游戏自组网系统

目录 游戏说明《宝可梦 Mesh GO》 —— 局域宝可梦探索Pokmon GO 类游戏核心理念应用场景Mesh 特性 宝可梦玩法融合设计游戏构想要素1. 地图探索&#xff08;基于物理空间 广播范围&#xff09;2. 野生宝可梦生成与广播3. 对战系统4. 道具与通信5. 延伸玩法 安全性设计 技术选…...

docker 部署发现spring.profiles.active 问题

报错&#xff1a; org.springframework.boot.context.config.InvalidConfigDataPropertyException: Property spring.profiles.active imported from location class path resource [application-test.yml] is invalid in a profile specific resource [origin: class path re…...

sipsak:SIP瑞士军刀!全参数详细教程!Kali Linux教程!

简介 sipsak 是一个面向会话初始协议 (SIP) 应用程序开发人员和管理员的小型命令行工具。它可以用于对 SIP 应用程序和设备进行一些简单的测试。 sipsak 是一款 SIP 压力和诊断实用程序。它通过 sip-uri 向服务器发送 SIP 请求&#xff0c;并检查收到的响应。它以以下模式之一…...