use*_*971 34 android android-library android-studio
我最近下载了ViewPagerIndicator库并将其导入android studio.将它添加到我的项目后,我得到一个渲染错误"无法找到以下类:"并指向com.viewpagerindicator.IconPageIndicator.
我采取的步骤是Files->Import Module->'library name',Project Structure -> Dependencies -> + the imported module.然后到我的布局xml文件我添加了<com.viewpagerindicator.IconPageIndicator />,之后我得到了缺少的类问题.
它编译得很好,我浏览了所有build.gradle和settings.gradle文件,并将它们与在线应该进行比较.
MyApp->build.gradle具有compile project(':library')下dependencies
settings.gradle有include ':library'没有生成错误.
Bah*_*mir 39
首先,您必须按照该路径导入库项目:
File --> New --> Import Module
Run Code Online (Sandbox Code Playgroud)
成功导入库项目后,如果"dependencies"部分中存在以下行,则必须检查项目文件夹中的build.gradle文件:
implementation project(':NameOfTheLibProject')
Run Code Online (Sandbox Code Playgroud)
然后您的项目必须成功构建.
Qui*_*don 11
我发现我的问题是项目结构下的Android插件版本 - > Project与我的插件所使用的版本不同.一旦我将它们对齐到相同的版本,我就可以从导入的模块中看到我的所有类.
花了我几个小时:(
我也无法导入模块,因为它没有出现在模块列表中.它的工作方式是手动输入settings.gradle这样:
include ':app', 'module_name'
Run Code Online (Sandbox Code Playgroud)
在build.gradle中
compile project(':module_name')
Run Code Online (Sandbox Code Playgroud)
就我而言,我确实在appgradle 中添加了:
// Nearly deprecated.
compile project(':NameOfTheLibProject')
// Or
implementation project(':NameOfTheLibProject')
Run Code Online (Sandbox Code Playgroud)
但它只在我改变时有效
compileSdkVersion
minSdkVersion
targetSdkVersion
Run Code Online (Sandbox Code Playgroud)
inapp和其他模块是一样的。
| 归档时间: |
|
| 查看次数: |
40403 次 |
| 最近记录: |