Giter VIP home page Giter VIP logo

launcher3's Introduction

Launcher3

​ 本工程旨在创建一个可以在Android Studio中编译、调试的Launcher3工程。如果有其他Android App有同样的需求,可做参考。

由于Launcher3使用了一些私有的API,比如`android.app.WallpaperColors`,这些导致Android Studio使用标准的sdk编译不过。

1. 获取framework.jar

framework.jar可通过编译android官方的aosp工程获得,编译时间较长。生成的路径为:

out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes.jar

如果不知道如何编译android源码,可参考Google官方构建编译环境指南,当然如果不敢兴趣,可使用我上传的freeme-framework.jar.

2. 放置framework.jar

新建libs目录,在本文我重命名为 freeme-framework.jar并放在此libs目录。

3. 修改build.gradle

dependencies {
    //provided是指这个库仅仅在编译时使用,但最终不会被编译到apk或aar里
    provided files('libs/freeme-framework.jar')
    
    ...
}

//添加此处配置,意在调整编译时优先加载freeme-framework.jar,这样才能让使用某个公共类中的私有api不会报错
//-Xbootclasspath/p是java编址的优先寻址设置
//"Xbootclasspath/p"后接的路径,是相对于当前Project的根目录的相对路径
gradle.projectsEvaluated {
    tasks.withType(JavaCompile) {
        options.compilerArgs << '-Xbootclasspath/p:libs/freeme-framework.jar'
    }
}

最后,就可以顺利运行了

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.