从日食消费AARS不起作用 [英] Consuming aars from eclipse does not work

查看:410
本文介绍了从日食消费AARS不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

*这部分我原来的起动问题。请阅读更新结果
我已导入在Eclipse中的Andr​​oid项目,显然取决于 rengwuxian 。结果
因为我无法找到罐子,不知道该怎么做,我跟着的消费-AARS月食和进口来自AAR的文物为Android Eclipse项目,以及第二个项目。

*THIS PART WAS MY ORIGINAL STARTING PROBLEM. PLEASE READ THE UPDATES
I have imported an android project in eclipse that apparently depends on rengwuxian.
Since I could not find the jar and did not know how else to do it, I followed the instructions in consuming-aars-eclipse and imported a second project with the artifacts from the aar as an android eclipse project as well.

然后在我原来的项目,我在我的布局文件有编译错误的 com.rengwuxian.materialedittext.MaterialEditText 我加入这个新从AAR项目创建作为参考(项目 - >属性 - >建设Path->添加项目)

Then in my original project that I got compilation errors for com.rengwuxian.materialedittext.MaterialEditText in my layout files I added this newly created from the aar project as a reference (Project->Properties->Build Path->Add Project)

编译错误得到解决!的的在我的布局文件现在到处都是被定义的元素 com.rengwuxian.materialedittext.MaterialEditText 我得到在资源定义错误。

The compilation errors got resolved! But in my layout files now everywhere that is defined the element com.rengwuxian.materialedittext.MaterialEditText I get errors in the resource definitions.

Eg.the如下:

错误:在没有发现属性baseColor'资源标识符
  包'com.test

error: No resource identifier found for attribute 'baseColor' in package 'com.test

该attibute似乎抱怨的是:

The attibute it seems to complaint about is:

<com.rengwuxian.materialedittext.MaterialEditText
            android:id="@+id/client"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            .....
            android:textColor="@color/text_color"
            app:baseColor="@color/text_color"
            app:primaryColor="@color/text_color" />

--->应用程序:baseColor =@色/ text_color

---> app:baseColor="@color/text_color"

@色/ text_color 在我原来的应用程序是指在原有的应用程序的软件包,显然是在AAR导入项目类(com.rengwuxian.materialedittext.MaterialEditText)不能看到/访问这些资源。

This @color/text_color is defined in my original application in the original application's package and apparently the classes in the aar imported project (com.rengwuxian.materialedittext.MaterialEditText) can not see/access these resources.

我该如何解决这个问题?还是有我的问题的另一种更好的办法?

How can I fix this? Or is there another better way for my problem?

注:我也尝试添加源链接到我的项目的资源/文件夹的文件夹,但并没有解决这个问题。

Note: I also tried adding a source link to the folder of my project's res/ folder but did not solve this.

更新:结果
我删除了参考项目和classes.jar添加到构建路径(这罐子是AAR项目中)。同样的问题

Update:
I removed the reference to the project and add the classes.jar to the build path (this jar was inside the aar project). Same issue

更新2:结果
我发现这有助于导入AARS偏食 AAR换蚀。我复制/粘贴code段(任务copyJarDependencies等)的文件夹中,但我有一个例外:

UPDATE 2:
I found this that helps to import aars to eclipse aar-for-eclipse. I copy/pasted the code snippets (task copyJarDependencies etc) in the folder but I got an exception:

没有这样的属性:LIBDIR类:org.gradle.api.tasks.Copy_Decorated

No such property: libDir for class: org.gradle.api.tasks.Copy_Decorated

所以我在该行增加了高清`LIBDIR =新的文件(project.projectDir,'/库)
那么这个工作,但我得到了:

So I added a def in the line `libDir = new File(project.projectDir, '/libs') Then this worked but I got:

无法找到配置容器属性编译

Could not find property 'compile' on configuration container

如何解决这个问题?我不知道要申报什么或丢失

How can fix this? I am not sure what to declare or what is missing

更新3:结果
我加了应用插件:Java的和编译属性是现在好,但我得到:

Update 3:
I added apply plugin: 'java' and the compile attribute is ok now but I get:

configurations.releaseCompile.filter {it.name.endsWith'罐子'}每{文件文件 - > moveJarIntoLibs(文件)}

configurations.releaseCompile.filter {it.name.endsWith 'jar'}.each { File file -> moveJarIntoLibs(file)}

我怎样才能解决这个问题,这样它的工作原理?结果
我使用的这个项目--->
https://github.com/rengwuxian/MaterialEditText 结果
和这个职位---> http://www.nodeclipse.org/项目/ gradle这个/安卓/ AAR-换Eclipse的

How can I fix this so that it works?
I am using this project ---> https://github.com/rengwuxian/MaterialEditText
And this post ---> http://www.nodeclipse.org/projects/gradle/android/aar-for-Eclipse

推荐答案

我已经得到的gradle用,但是在Android工作室类似的问题。解决方案我是使用

I've got a similar problem with gradle but on android studio. Solution for me was to use

configurations.releaseCompile.filter {it.name.endsWith'罐子'}。{各moveJarIntoLibs(它)}

而不是:

configurations.releaseCompile.filter {it.name.endsWith'罐子'} {每个文件的文件 - 过夜。; moveJarIntoLibs(文件)}

和记住不要申请Java和Android插件在同一个项目,因为它不会工作(见用的gradle --debug --stacktrace)

And remember not to apply java and android plugin in the same project, because it won't work (see gradle with --debug --stacktrace )

这篇关于从日食消费AARS不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆