Android plugin (using the Small framework)

Source: Internet
Author: User

Android plugin (using the Small framework)
Android plug-in (using the Small framework) Framework Source Code 1. Create Project

File-> New Project...

1.1 Configure your new project

Assume that the host package is namedcom.example.mysmall

  1. Set Application nameMySmall
  2. Modify Company Domaincom.example.mysmall

    This step is a tip. When step 3 creates a Module, it will automatically carry this prefix.

  3. Modify Package namecom.example.mysmall

    1.2 Add an activity to mobile

    We recommend that you use Fullscreen Activity as the startup interface. On the Activity configuration page, we recommend that you change the Activity Name to LaunchActivity (to validate the Name ).

    2. Configure Small

    Modify build. gradle of a Project

    2.1 Add to the Small compilation Library
    buildscript {    repositories {        jcenter()    }    dependencies {        classpath 'com.android.tools.build:gradle:1.3.0'        classpath 'net.wequick.tools.build:gradle-small:0.1.1'    }}...apply plugin: 'net.wequick.small'
2.2 configure Small DSL (optional)

Currently, only one attribute exists.aarVersionIndicates the version of the Small aar code base. If not set, the default value isgradle-small.

small {    aarVersion = '0.1.2'}

The latest version number can be seen on Bintray.

3. Create Module

File-> New-> Module:

  1. The module name is shown as follows:app.*,lib.*Orweb.*
  2. Package name includes:.app.,.lib.Or.web.

    Why? Because Small classifies the plug-ins according to the package name, special domain name space such as ". app." makes this easy.

    Pairlib.*Choose Android Library for the Module, and Phone & Tablet Module for other modules.

    Create a plug-in module, suchapp.main:

    1. Modify Application/Library nameApp.main
    2. Change Package namecom.example.mysmall.app.main

      4. Configure UI route

      Right-clickappModule-> New-> Folder-> Assets Folder, NewassetsDirectory,

      Right-clickassetsDirectory-> New-> File, Newbundles.jsonFile, add:

      {  "version": "1.0.0",  "bundles": [    {      "uri": "main",      "pkg": "com.example.mysmall.app.main"    }  ]}
      5. Setup Small5.1 configure the signature

      SwitchProjectDirectory tree, right-clickMySmall, NewsignDirectory, addrelease.jksSignature file.

      InappModulebuild.gradleAdd the signature configuration (change the password to your own ):

      signingConfigs {    release {        storeFile file('../sign/release.jks')        storePassword "5mall@ndro!d"        keyAlias "small"        keyPassword "5mall@ndro!d"    }}buildTypes {    release {        signingConfig signingConfigs.release    }}
      5.2 configure basic Dependencies

      InappThe module adds shared dependent libraries, such:

      compile 'com.android.support:design:23.1.1'
      5.3 load plug-ins

      InappModuleLaunchActivityHeavy LoadonStartMethod:

      @Overrideprotected void onStart() {    super.onStart();    Small.setBaseUri("http://example.com/");    Small.setUp(this, new net.wequick.small.Bundle.OnLoadListener() {        @Override        public void onStart(int bundleCount, int upgradeBundlesCount, long upgradeBundlesSize) {        }        @Override        public void onProgress(int bundleIndex, String bundleName, long loadedSize, long bundleSize) {        }        @Override        public void onComplete(Boolean success) {            Small.openUri("main", LaunchActivity.this);        }    });}
      6. Compile Small
      1. Build libraries (prepare the Basic Library)

        [./] Gradlew buildLib-q (-q is a quiet mode, which can make the output look better or not)

      2. Build bundles (package all components)

        [./] Gradlew buildBundle-q (-q is a quiet mode, which can make the output look better or not)

        If you like the two steps, you can also run

        You can use [./] gradlew-p web. about javaserelease to compile a component separately.
        Or

        7. Run Small

        In the toolbar, select the app module to run.

        . Directory structure Exception Handling 1. the above steps are provided, but note that when creating a plug-in module, for example, the input is app. in this case, the package name must be changed to com. example. small. app. main instead of com. example. small. if appmain runs like this, problems may occur. 2. If the compilation fails, run./gradlew cleanLib first.

         

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.