简体   繁体   English

Android项目中的AIDL文件:奇怪的“包”语法错误

[英]AIDL file in Android project: strange “package” syntax error

I create Android project with plugins. 我用插件创建Android项目。 When I create simple AIDL file, the compilation breaks with strange errors and no interface class is generated. 当我创建简单的AIDL文件时,编译会因奇怪的错误而中断,并且不会生成任何接口类。

My AIDL file: 我的AIDL文件:

package com.android.example.tryplugin
interface IResPlugin {
    Bundle onClick( in int id, in int state );
}

I have the following errors: 我有以下错误:

syntax error don't know what to do with "package"   
syntax error don't know what to do with "com.android.example.tryplugin" 
syntax error don't know what to do with "package"

I have also tried all advices from Google like "Try to clean and recompile", "Create new project with these files" etc. What is wrong with it? 我还尝试了Google的所有建议,例如“尝试清理并重新编译”,“使用这些文件创建新项目”等。这有什么问题?

I met the similar problem before, but the cause is not same with your, the AIDL file used the CR as line break on my Windows platform, the AIDL parser could not handle it and kept crashing. 我之前遇到过类似的问题,但原因与您不一样,AIDL文件在Windows平台上使用CR作为换行符,AIDL解析器无法处理它并不断崩溃。 The parser worked well after I changed the CR to CR LF combination. 在将CR更改为CR LF组合之后,解析器运行良好。

Hope it helps. 希望能帮助到你。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM