相关疑难解决方法(0)

如何用Android Studio和gradle构建一个Android库?

我正在尝试从Eclipse迁移项目,但我尝试过的任何工作都没有.在Eclipse中我有3个项目(2个Android应用程序项目和1个android库项目).2个app项目取决于库项目.当我进行gradle导出时,我得到3个不起作用的项目.我愿意重组该项目,但没有找到任何关于如何完成这项工作的文件.

有没有办法让Eclipse导出的3个项目一起工作?我是否最好重组一些事情,如果是这样的文件应该怎么做呢?

更新

我已将整个项目上传到GitHub https://github.com/respectTheCode/android-studio-library-example

更新1

根据Padma Kumar的建议,这就是我所尝试的.

  1. 创建一个名为的新项目 MyApp
  2. 单击File > New Module,选择Android Library并命名MyLib
  3. 点击 Build > Make Project

构建因此错误而失败

Module "MyLib" was fully rebuilt due to project configuration/dependencies changes
Compilation completed with 1 error and 0 warnings in 19 sec
1 error
0 warnings
/.../MyApp/MyLib/build/bundles/debug/AndroidManifest.xml
Gradle: <manifest> does not have package attribute.
Run Code Online (Sandbox Code Playgroud)

然后我package在清单中添加了一个属性

<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.mylib" >
Run Code Online (Sandbox Code Playgroud)

建成后我得到了这个错误

Module "MyApp" was fully rebuilt due to project configuration/dependencies changes
Compilation completed with …
Run Code Online (Sandbox Code Playgroud)

android gradle android-studio

143
推荐指数
2
解决办法
17万
查看次数

Android Studio中的Gradle:无法解析第三方库

我一直在尝试将我的项目从Intellij切换到Android Studio,这需要我创建一个build.gradle文件.我知道我可以将每个作为库依赖项添加,但我理想的是希望能够使maven存储库依赖项工作.

每次我同步时,我的支持库都会很好地同步,但对于每个第三方库,我都会得到类似的结果

"错误:(30,13)无法解决:com.facebook.android:facebook-android-sdk:3.23.1"

为每个图书馆.

buildscript {
repositories {
    mavenCentral()
}
dependencies {
    classpath 'com.android.tools.build:gradle:1.1.0'
}
}
apply plugin: 'com.android.application'

dependencies {

compile fileTree(dir: 'libs', include: '*.jar')

// Google Play Services
compile 'com.google.android.gms:play-services:6.5.87'

// Support Libraries
compile 'com.android.support:appcompat-v7:22.0.0'
compile 'com.android.support:cardview-v7:21.0.3'
compile 'com.android.support:gridlayout-v7:21.0.3'
compile 'com.android.support:mediarouter-v7:21.0.3'
compile 'com.android.support:palette-v7:21.0.3'
compile 'com.android.support:recyclerview-v7:21.0.3'
compile 'com.android.support:support-annotations:21.0.3'
compile 'com.android.support:support-v13:21.0.3'
compile 'com.android.support:support-v4:22.0.0'

// third-party libraries
compile 'com.amazonaws:aws-java-sdk:1.9.24'
compile 'com.facebook.android:facebook-android-sdk:3.23.1'
compile 'com.github.markushi:android-ui:1.2'
compile 'de.hdodenhof:circleimageview:1.2.2'
compile 'it.neokree:MaterialNavigationDrawer:1.3.2'

}

android {
compileSdkVersion 21
buildToolsVersion "21.1.2"

sourceSets {
    main {
        manifest.srcFile 'AndroidManifest.xml' …
Run Code Online (Sandbox Code Playgroud)

android gradle android-studio android-gradle-plugin

15
推荐指数
3
解决办法
3万
查看次数

SlidingTabLayout选项卡之间的通信

我已经搜索了很多关于如何使用SlidingTabLayout在片段之间进行通信但是没有真正得到一个好答案.我知道使用ActionBar但是我想要使用SlidingTabLayout的android lollipop的新方法.我试过这个 - > http://android-er.blogspot.in/2012/06/communication-between-fragments-in.html但我想要材料设计.我将这个链接http://www.android4devs.com/2015/01/how-to-make-material-design-sliding-tabs.html用于制作材料设计滑动标签.现在我想知道如何在滑动标签之间进行通信.我已经尝试了很多,但找不到我想要的答案.任何帮助都会非常感激.

android android-fragments material-design

7
推荐指数
1
解决办法
2015
查看次数