Aidl compiled with Android Studio did not find a solution to the custom class

Source: Internet
Author: User
<span id="Label3"></p><p><p><span style="font-size: 16px;">When using as to create a Adil file, as will give us a aidl folder and a package with the same package name in the main folder, usually we will put all the Adil related classes or files under this package, but if there is a custom class, the program can not pass the compilation, the prompt cannot find the custom Package. The workaround is to include the following code in the Build.gradle that launches the Module:</span></p></p><pre><pre><span style="color: #000000;">sourcesets { main { </span>' src/main/androidmanifest.xml '<span style="color: #000000;"> </span>= [' Src/main/java ', ' src/main/ Aidl '<span style="color: #000000;">] </span>= [' src/main/java ', ' src/main/aidl '<span style="color: #000000;">] </span>= [' src/main/aidl '<span style="color: #000000;">] </span>= [' src/ Main/res '<span style="color: #000000;">] </span>= [' src/main/assets '<span style="color: #000000;">] } }</span></pre></pre><p><p>After joining, the complete Build.gradle file reads as Follows:</p></p><pre>Apply plugin: ' com.android.application '<span style="color: #000000;"><span style="color: #000000;">Android {compilesdkversion</span></span>23<span style="color: #000000;"><span style="color: #000000;">buildtoolsversion</span></span>"23.0.2"<span style="color: #000000;"><span style="color: #000000;">defaultconfig {applicationid</span></span>"aidl.aidl.demo"<span style="color: #000000;"><span style="color: #000000;">minsdkversion</span></span>14<span style="color: #000000;"><span style="color: #000000;">targetsdkversion</span></span>23<span style="color: #000000;"><span style="color: #000000;">Versioncode</span></span>1<span style="color: #000000;"><span style="color: #000000;">Versionname</span></span>"1.0"<span style="color: #000000;"><span style="color: #000000;">} sourcesets {main {manifest.srcfile</span></span>' Src/main/androidmanifest.xml '<span style="color: #000000;"><span style="color: #000000;">Java.srcdirs</span></span>= [' Src/main/java ', ' src/main/aidl '<span style="color: #000000;"><span style="color: #000000;">] Resources.srcdirs</span></span>= [' Src/main/java ', ' src/main/aidl '<span style="color: #000000;"><span style="color: #000000;">] Aidl.srcdirs</span></span>= [' Src/main/aidl '<span style="color: #000000;"><span style="color: #000000;">] Res.srcdirs</span></span>= [' Src/main/res '<span style="color: #000000;"><span style="color: #000000;">] Assets.srcdirs</span></span>= [' Src/main/assets '<span style="color: #000000;"><span style="color: #000000;">]}} buildtypes {release {minifyenabled</span></span><span style="color: #0000ff;"><span style="color: #0000ff;">false</span></span><span style="color: #000000;"><span style="color: #000000;">proguardfiles Getdefaultproguardfile (</span></span>' Proguard-android.txt '), ' Proguard-rules.pro '<span style="color: #000000;"><span style="color: #000000;">}}}dependencies {compile filetree (dir:</span></span>' Libs ', include: [' *.jar '<span style="color: #000000;"><span style="color: #000000;">]) Testcompile</span></span>' junit:junit:4.12 '<span style="color: #000000;"><span style="color: #000000;">Compile</span></span>' com.android.support:appcompat-v7:23.1.1 '<span style="color: #000000;"><span style="color: #000000;">}</span></span></pre><p><p>Sourcesets in the main is to put Src/main/aidl file also as java.srcdirs, resources.srcdirs, so when compiling the program, aidl in the custom class can be found.</p></p><p><p>Aidl compiled with Android Studio did not find a solution to the custom class</p></p></span>

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.