小米便签从0到1维护教程
小米便签开源社区版从0到1维护教程
1.前置条件-------软件的安装:
开发工具:Android studio
下载Android studio
汉化教程
安装请自行解决
SDK版本以及相关文件
SDK Tools:
小米便签的维护:
下载小米便签的源码:
下载地址:小米便签源码下载
源文件结构如上图,显而易见,源文件里面没有grandle项目管理工具,因此在用android studio打开的时候,要使用下面的方式
这种方式会为项目添加一个gradle,打开项目后,等待项目加载完成,然后讲javaJDK 版本更改成JDK8(我在维护的时候这里报过错,没有报错的可以不改)
流程如下:
点击文件,选择项目结构
选择SDK Location,再点击Gradle Settings
将JDK设置为Java8
打开项目过后结果:
此时,项目报错:
Could not find com.android.tools.build:gradle:7.4.2.
Searched in the following locations:https://jcenter.bintray.com/com/android/tools/build/gradle/7.4.2/gradle-7.4.2.pom
If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
Required by:
project :
Add google Maven repository and sync project
Open File
根据提示,我们在在项目的 build.gradle(Project:Notes)
文件中添加 Google Maven 仓库。你可以在 repositories
块中添加以下代码:
maven {url 'https://dl.google.com/android/maven2'}
添加完后如下:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {repositories {maven {url 'https://dl.google.com/android/maven2'}jcenter()}dependencies {classpath 'com.android.tools.build:gradle:7.4.2'}
}allprojects {repositories {jcenter()}
}
添加完成后点击右上角的图标:
此时,开始下载组件:
等待下载,下载过程中,可能会出现问题:
A problem occurred configuring root project 'Notes'.Could not resolve all files for configuration ':classpath'.
Could not download kotlin-stdlib-common-1.7.10.jar (org.jetbrains.kotlin:kotlin-stdlib-common:1.7.10)
> Could not get resource 'https://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-stdlib-common/1.7.10/kotlin-stdlib-common-1.7.10.jar'.
> Could not GET 'https://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-stdlib-common/1.7.10/kotlin-stdlib-common-1.7.10.jar'.
> The server may not support the client's requested TLS protocol versions: (TLSv1.2, TLSv1.3). You may need to configure the client to allow other protocols to be used. See: https://docs.gradle.org/7.5/userguide/build_environment.html#gradle_system_properties
> Remote host terminated the handshake
这个问题是当前正在使用的仓库已经停止维护,我们使用maven仓库来代替原来的仓库,向项目的 build.gradle(Project:Notes)
文件中,你可以添加以下代码来使用 Maven 中央仓库:
repositories {mavenCentral()
}
添加完成后,整个代码如下:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {repositories {mavenCentral()maven {url 'https://dl.google.com/android/maven2'}jcenter()}dependencies {classpath 'com.android.tools.build:gradle:7.4.2'}
}allprojects {repositories {jcenter()}
}
现在点击更新,会出现一处错误:
Execution failed for task ':app:mergeDebugResources'.A failure occurred while executing com.android.build.gradle.internal.res.Aapt2CompileRunnable
Could not isolate value com.android.build.gradle.internal.res.Aapt2CompileRunnable$Params_Decorated@7e8ac076 of type Aapt2CompileRunnable.Params
> Could not resolve all files for configuration ':app:detachedConfiguration2'.
> Could not find com.android.tools.build:aapt2:7.4.2-8841542.
Searched in the following locations:
- https://jcenter.bintray.com/com/android/tools/build/aapt2/7.4.2-8841542/aapt2-7.4.2-8841542.pom
If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
Required by:
project :app
我们在build.gradle(Project:Notes)文件里面添加一行代码:
google()
添加后完整代码如下:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {repositories {mavenCentral()maven {url 'https://dl.google.com/android/maven2'}google()jcenter()}dependencies {classpath 'com.android.tools.build:gradle:7.4.2'}
}allprojects {repositories {google()jcenter()}
}
现在,我们再次构建:映入眼帘的是一个包的错误:
这个错误产生的原因是在 Android 中,org.apache.http
包已经被废弃,不再推荐在 Android 应用程序中使用,但是我们可以对这个这个包做一个兼容:在build.gradle(Module: App)里面添加
useLibrary 'org.apache.http.legacy'
完整代码:
apply plugin: 'com.android.application'android {compileSdkVersion 33buildToolsVersion "33.0.2"defaultConfig {applicationId "net.micode.notes"minSdkVersion 14targetSdkVersion 33useLibrary 'org.apache.http.legacy'}buildTypes {release {minifyEnabled falseproguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'}}
}
再次点击更新配置
包的错误暂时解决,不维护网络功能,另外,在GTaskASyncTask.java中,有一个方法报错:
我们将这个过时的方法更改掉:
// notification.setLatestEventInfo(mContext, mContext.getString(R.string.app_name), content,
// pendingIntent);notification.contentIntent = pendingIntent;mNotifiManager.notify(GTASK_SYNC_NOTIFICATION_ID, notification);
解决这个错误后,还有一个配置文件的错误:
这个错误是因为在 Android 12 及更高版本中,如果一个组件(如 Activity、Service 或 BroadcastReceiver)定义了 Intent 过滤器,则必须显式指定 android:exported
属性,以确保该组件只能被期望的应用程序或系统组件调用。如果没有指定 android:exported
属性,系统将会认为该组件是公开的,从而可能导致安全漏洞。为了解决这个问题,我们依次在报错的地方加上
android:exported="true"
android:exported="false"
如下:
双击报错位置:
来到报错的地方,依次更改:
打开AndroidManifest.xml文件,可以看到报错的地方:
控制台显示:
这个错误是由于 <data>
元素缺少 URI 属性所致。<data>
元素用于指定 Intent 的数据 URI,如果你在 <data>
元素中指定了数据类型(如 android:mimeType
属性),则还必须指定数据 URI。如果没有指定数据 URI,系统将会认为数据缺失,从而导致 “Missing URL” 错误。
将报错的代码替换为:
<intent-filter><action android:name="android.intent.action.VIEW" /><category android:name="android.intent.category.DEFAULT" /><data android:mimeType="vnd.android.cursor.item/text_note" android:scheme="content" android:host="com.example.notes.provider" android:path="/notes" /><data android:mimeType="vnd.android.cursor.item/call_note" android:scheme="content" android:host="com.example.notes.provider" android:path="/notes" />
</intent-filter>
现在,我们已经解决了所有让程序停止运行的问题,点击运行一下:
这样,小米便签就能够运行起来了
到这里没有运行成功不要灰心~,下面是我打包的运行成功的程序:
点击下载
提取码:v6qd
链接:https://pan.xunlei.com/s/VNVEyleS4tQUNft2-DTE7x30A1#
提取码:v6qd
制作不易,对您有用请留赞~~~~~
小米便签从0到1维护教程相关推荐
- 小米便签维护过程记录——可能出现问题解决方案
在对小米便签开源代码进行研究和维护及新功能开发的同时,会遇到很多问题,将以本文进行记录总结. 导入项目 若不导入直接Open会导致默认为Project,不为Android. 小米标签菜单栏不显示的问题 ...
- 在Win10以及SDK为33的环境下——小米便签项目的搭建
文章目录 0. 我的操作系统和开发环境 1. 相关文件下载: 2. import project: 2.1 用import project导入项目 3. make project: 3.1 AS中的命 ...
- 在Android Studio下配置小米便签
在Android Studio下配置小米便签 Android studio2022的下载与安装 在官网下载最新安装包Download Android Studio & App Tools - ...
- 小米便签开源项目本地环境搭建
基于Android Studio.和Gradle 的小米便签配置和安装 一.Android Studio的中文社区(官网)下载最新的Android Studio 点击开始传送http://www.an ...
- LitePal+RecyclerView+checkBox实现便签功能(仿小米便签)
费时两天,主要难点在RecyclerView和CheckBox的长按事件上. 上代码: Note的JavaBean: package com.example.jarvist.remember;impo ...
- Windows下桌面便签小工具--StickyPad简单使用教程(非StickyNotes)
便利贴Windows自带有一种,但由于他会占任务栏,就搜索了一个可以放后台,文件也比较小的.无广告的StickyPad. 第一种:win10自带: Windows10下面自带的便利贴小程序是Stick ...
- Android:仿小米便签,图文混排
经过两天的摸索,终于实现,现在贴出来,供自己学习记录及与小伙伴们交流分享 先看下效果图: (添加按钮,用于添加图片) 话不多说,小翠上代码: 1.布局文件: <RelativeLayout xm ...
- 从零开始写一个小米便签
2015.10.21(第五天) 目标:采用ListView实现列表 前言:整个实现的过程是视图+控制器+数据填充 视图通:过ListView控件来实现,以列表的形式显示数据. 控制器:通过Adapte ...
- 用python和adb将一加便签内容迁移到小米或其他品牌便签软件
(暂时不支持图片) 最近手机从一加换到小米了.因为平时喜欢写备忘录,一加便签里记了很多条信息.但是手机搬家只能搬一个没有签名的阉割版一加便签过来,原来记的笔记都没了.网上一搜解决办法全是莫名其妙的啥波 ...
最新文章
- 智能改变未来,创新引领世界,第二届深圳国际人工智能展暨智能制造创新高峰论坛盛大启幕!
- arXiv | 图表示方法驱动大分子计算研究
- 把mysql安装到服务器端_MySQL服务器端安装
- 图灵新浪微博赠书活动
- 我的Android进阶之旅------Android自定义View来实现解析lrc歌词并同步滚动、上下拖动、缩放歌词的功能...
- 突破对银河系的传统认知 大量超高能宇宙加速器被发现
- React-Router ---withRouter
- #6073. 「2017 山东一轮集训 Day5」距离(树链剖分 + 永久标记主席树)
- 微信公众号大转盘抽奖活动链接怎么添加
- MATLAB教程(1) MATLAB 基础知识(2)
- 浅析Microsoft .net PetShop程序中的购物车和订单处理模块(Profile技术,异步MSMQ消息)
- C程序设计 4顺序程序设计
- 数据结构之二叉查找树介绍
- 适合 Go 新手学习的开源项目——在 GitHub 学编程
- JAVA实现成语大全-成语接龙,给小孩的应用
- 查看Sql Server2016是否激活
- 需求调研报告模板_培训需求调研报告不会写,遇到问题咋解决?
- python中索引越界的常见原因
- 阿里云网盘开启公测!不限速、2T永久免费空间!!
- Python练习实战股票网页数据
热门文章
- R语言︱LDA主题模型——最优主题数选取(topicmodels)+LDAvis可视化(lda+LDAvis)
- 百度编辑器ueditor工具栏
- 「DP Rec.」[USACO21JAN] Uddered but not Herd G
- 蓝桥杯单片机竞赛第四届(自动售水机项目)
- Javascript面向对象编程思考与总结
- rust中i32转[i8]和[u8]转i32
- openwrt procd init脚本用法总结
- 探索性数据分析(Exploratory Data Analysis,EDA)
- 抓取微信小程序公众号数据包
- 笔记本不能上网的原因和维修方法