Coder Social home page Coder Social logo

android-project-template's Introduction

本项目是由gradle init创建的基础项目拓展而来。

目的就是创建一个干净的Android项目模版。

在拓展的过程中,不断了解Android的构造。

复用

当你复用该项目的时候以下几个方面是你应该考虑的。


项目

  • ./build.gradle.ktsrootProject.name修改成你的项目名
  • 重置idea,你需要删除文件夹./.idea
  • 重置git,你需要删除文件夹./.git
  • 重写./README.md

模块

  • 修改包名,避免相互依赖的多个项目包名冲突,不得不提醒的是,当你更改包名的时候,你需要更改对应类下 package 包名

应用模块

  • 将模块下 build.gradle.ktsandroid 闭包中的 applicationId 字段修改为你的项目独有的,防止相同的applicationId安装包进行覆盖
  • (可选)./app/src/main/AndroidManifest.xmlapplication标签属性android:label应该被添加,以便于识别

库模块

  • 当你删除库模块时,你应该考虑应用模块对库模块的依赖关系。

计划

  • 创建一个shell脚本帮助我们完成复用操作

Q&A

为什么我无法通过R引用资源?

请确保./app/src/main/AndroidManifest.xmlmanifest标签包含package属性;请不要使用src/main/build.gradle.ktsandroid的闭包的namespace属性。


In IntelliJ/Android Studio, How Do I Fix "These Files Do Not Belong to the Project"?

This happened for me when I ignored the .idea/ files. Just do

rm -rf .idea/

And then File -> Invalidate Caches/Restart -> Invalidate And Restart.

android-project-template's People

Contributors

ming2k avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.