Android Studio Configuration Androidannotations--hi_ Blog Android APP Development notes

Source: Internet
Author: User

Used to use ECLICPS used to now want to learn to use Android Studio two days of study finally on my computer installed an Android studio and completed the Androidannotations configuration.

Androidannotations is an open source framework that allows you to develop your Android quickly, allowing you to focus on what really matters. Making the code more streamlined makes the project easier to maintain, and its goal is "Fast Android development.easy maintainance". Plainly, you can write a lot less code, haha.

Androidannotations is an open source project project address interested friends can go and study. All right, that's not much nonsense.

1 We need to download the androidannotations.

2 new Folder Compile-libs

3 copy Androidannotations-3.2.jar to compile-libs Androidannotations-api-3.2.jar copy to Libs

Such as:

4 Add classpath ' com.neenbedankt.gradle.plugins:android-apt:1.4 ' to the build.gradle of the project

Such as:

5 added in the model's Build.gradle

5.1 Apply plugin: ' Android-apt '

def aaversion = ' 3.2+ '

5.2 Apt "org.androidannotations:androidannotations: $AAVersion"
Compile "Org.androidannotations:androidannotations-api: $AAVersion"
Compile ' com.android.support:support-v4:22.1.1 '

5.3 Apt {

arguments {

Androidmanifestfile Variant.outputs[0].processresources.manifestfile

Resourcepackagename ' Org.shuaibi.hi_blog '

}

}

Such as:

The configuration is done here, let's see how to use it.

Package Org.shuaibi.hi_blog.activity;import Android.app.activity;import android.content.intent;import Android.os.bundle;import Android.widget.textview;import Android.widget.toast;import Org.androidannotations.annotations.afterviews;import Org.androidannotations.annotations.click;import Org.androidannotations.annotations.eactivity;import Org.androidannotations.annotations.viewbyid;import Org.shuaibi.hi_blog. R; @EActivity (R.layout.activity_main)//Specify a ViewPublic class Mainactivity extends Activity {@ViewById (R.id.main_tv_hello) TextView Mhelloword;//Bound Control@Override protectedvoidonCreate (Bundle savedinstancestate) {super.oncreate (savedinstancestate); } @Click (R.id.main_tv_hello)//Click events to pressPublicvoidHello_click () {Intent Intent=NewIntent ( This, Blogdetailactivity_.class);    StartActivity (Intent); } @AfterViews//execution After the view has been loadedPublicvoidinit () {Toast.maketext ( This, "View loading Complete", Toast.length_short). Show (); }}

Finally, add _ to the activity in the Androidmanifest file (this is a lower horizontal bar)

If you want to configure in Eclipse please go here--send

Not very familiar with Android Studio what's wrong, please advise

Android Studio Configuration Androidannotations--hi_ Blog Android APP Development notes

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.