Android studio 创建aidl文件无法生成Java文件或Java文件为空(没有内容)

as创建aidl生成的Java文件为空

在这里mark一下我自己发现的解决方案:

起初,我也搜索了很多篇博客文章,他们的方法还是没有解决我的问题,

他们的解决方法是, build-->rebuild project, 我告诉你他们的这个方法

是解决as根本没有生成aidl对应的Java文件.在我这里的问题有点不一

样,我生成了aidl对应得Java文件,但是这个Java文件是空得,没有代码得

Java文件,我反复尝试了将近两个小时,都没有解决...............................

.
.	
.
.
.
.
.
.

经过多次尝试之后,我然后在aidl文件里面写了这样一句代码,生成Java成功

package com.example.date01;

// Declare any non-default types here with import statements

interface IMediaService {

    void basicTypes(int anInt, long aLong, boolean aBoolean, float aFloat,
            double aDouble, String aString);

    void hello();
}
	

我之前一直报错得代码是这样子的

package com.example.date01;

// Declare any non-default types here with import statements

interface IMediaService {

    void basicTypes(int anInt, long aLong, boolean aBoolean, float aFloat,
            double aDouble, String aString);

	//开始音乐
    void openAudio(int position);
    //开始播放
    void start();
    //暂停
    void pause();
}

发现有什么区别了没(这是细节)

.
.
.
.
.
.

最后给出解决方案:

问题所在: 带中文注释得aidl文件生成得Java文件为空
解决就是,把注释去掉或者添加英文注释

.
.
.
.
不知道这个方法对你们是否有效,我的as版本是3.5

发布了89 篇原创文章 · 获赞 13 · 访问量 7690

猜你喜欢

转载自blog.csdn.net/printf123scanf/article/details/100523774