在Android Studio下配置小米便签

06-01 1311阅读

在Android Studio下配置小米便签

        给看这篇博客的读者朋友说一下,本文是2023年前半年写的,可能在新版本的Android Studio下大家按我的教程按部就班配置可能不会成功,还望见谅,如果本文有误导给大家的地方请及时指出,我会及时整改,谢谢!

  • Android studio2022的下载与安装

    在官网下载最新安装包Download Android Studio & App Tools - Android Developers。

    在Android Studio下配置小米便签

    在Android Studio下配置小米便签

    一般情况下官网下载会比较慢,得开VPN,故推荐使用网盘链接下载与安装,详见Android studio2022安装包下载及安装教程,可根据需要自行选择是否汉化。(注:强烈建议跟着教程配置,不然一旦后期出问题,重装软件会很麻烦)

    • 下载小米便签源代码

      下载链接GitHub - richard0305/Notes-master

      在Android Studio下配置小米便签

      • 将源代码转换成gradle项目
        1. 打开Android studio,依次点击File->New->Import Project,

        在Android Studio下配置小米便签

        1. 选择源代码的路径,点击Next

        在Android Studio下配置小米便签

        1. 选择gradle项目的下载路径,点击Next

        在Android Studio下配置小米便签

        4、点击Create,创建gradle项目

        在Android Studio下配置小米便签

        • 修改并同步环境配置
          1. 打开已创建的gradle项目

          在Android Studio下配置小米便签

          1. 打开build.gradle文件,将下载源改为谷歌

          在下图所示的两个位置分别添加一行代码:google()

          在Android Studio下配置小米便签

          1. 打开app文件夹下的build.gradle文件

          删除原文件中的代码,复制粘贴以下代码到原文件中。

          apply plugin: 'com.android.application'

          android {

              useLibrary 'org.apache.http.legacy'

              compileSdkVersion 30

              buildToolsVersion "31.0.0"

              defaultConfig {

                  applicationId "net.micode.notes"

                  minSdkVersion 14

                  //noinspection ExpiredTargetSdkVersion

                  targetSdkVersion 29

              }

              buildTypes {

                  release {

                      minifyEnabled false

                      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'

                  }

              }

          }

          1. 点击右上角的Sync Now或者try again,将以上修改同步

          在Android Studio下配置小米便签

          以下是同步完成后的界面

          在Android Studio下配置小米便签

          五、构建项目并替换掉过时的代码

          1. 点击工具栏的绿色锤子,进行构建,会出现以下报错

          在Android Studio下配置小米便签

          1. 替换掉过时的代码

          将这段代码注释掉

          在Android Studio下配置小米便签

          替换为以下代码

          private void showNotification(int tickerId, String content) {

                  PendingIntent pendingIntent;

                  if (tickerId != R.string.ticker_success) {

                      pendingIntent = PendingIntent.getActivity(mContext, 0, new Intent(mContext,

                              NotesPreferenceActivity.class), 0);

                  } else {

                      pendingIntent = PendingIntent.getActivity(mContext, 0, new Intent(mContext,

                              NotesListActivity.class), 0);

                  }

                  Notification.Builder builder = new Notification.Builder(mContext)

                          .setAutoCancel(true)

                          .setContentTitle(mContext.getString(R.string.app_name))

                          .setContentText(content)

                          .setContentIntent(pendingIntent)

                          .setWhen(System.currentTimeMillis())

                          .setOngoing(true);

                  Notification notification=builder.getNotification();

                  mNotifiManager.notify(GTASK_SYNC_NOTIFICATION_ID, notification);

          }

          1. 再次点击工具栏的绿色锤子,进行构建,完成后出现如下界面

          在Android Studio下配置小米便签

          • 安装虚拟机
            1. 打开Device Manager, 点击create virtual device,创建虚拟机

            在Android Studio下配置小米便签

            1. 选择虚拟机样式,点击Next

            在Android Studio下配置小米便签

            1. 选择Pie,点击Next

            在Android Studio下配置小米便签

            4、给虚拟机命名,点击Finish

            在Android Studio下配置小米便签

            • 运行项目
              1. 选择刚创建的虚拟机,点击运行

              在Android Studio下配置小米便签

              1. 出现如下界面则运行成功

              在Android Studio下配置小米便签

              3、虚拟机不用的时候要关机,因为运行虚拟机会加大电脑耗电

              七、手机端运行小米便签

              打开如下路径的apk文件,即为小米便签的安装包,复制并通过QQ发送到手机端,进行安装,即可在手机端运行小米便签

              在Android Studio下配置小米便签

免责声明:我们致力于保护作者版权,注重分享,被刊用文章因无法核实真实出处,未能及时与作者取得联系,或有版权异议的,请联系管理员,我们会立即处理! 部分文章是来自自研大数据AI进行生成,内容摘自(百度百科,百度知道,头条百科,中国民法典,刑法,牛津词典,新华词典,汉语词典,国家院校,科普平台)等数据,内容仅供学习参考,不准确地方联系删除处理! 图片声明:本站部分配图来自人工智能系统AI生成,觅知网授权图片,PxHere摄影无版权图库和百度,360,搜狗等多加搜索引擎自动关键词搜索配图,如有侵权的图片,请第一时间联系我们。

目录[+]

取消
微信二维码
微信二维码
支付宝二维码