简体   繁体   English

在Android Studio 2.2.3中导入aar文件时出错

[英]Error Importing aar file in Android Studio 2.2.3

Steps taken: New ^ Module ^ Import aar/jar ^ choose file. 采取的步骤:新建^模块^导入aar / jar ^选择文件。 I see below exception. 我看到下面的异常。 Whats wrong ? 怎么了 ?

RuntimeException: java.lang.ClassCastException: com.android.tools.idea.gradle.parser.UnparseableStatement cannot be cast to com.android.tools.idea.gradle.parser.Dependency RuntimeException:java.lang.ClassCastException:com.android.tools.idea.gradle.parser.UnparseableStatement无法转换为com.android.tools.idea.gradle.parser.Dependency

If I put file in libs and add dependency in build.gradle compile (name: 'fileName', ext:'aar') is works alright. 如果我将文件放在库中,并在build.gradle中添加依赖项, compile (name: 'fileName', ext:'aar')就可以了。

Can someone tell me what's issue in first approch ? 有人可以告诉我第一次申请时有什么问题吗?

The IDE isn't tightly coupled with the build-tool. IDE与构建工具没有紧密结合。 Always add via the build tool (Gradle, in your case) when available. 如果可用,请始终通过构建工具(在您的情况下为Gradle)添加。

As for why an error exists. 至于为什么存在错误。 Probably a bug. 可能是错误。

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

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