标签: android-library

在应用程序中找不到传递库依赖项

假设我有一个库模块,其中包含一些第三方库,例如 OkHttp。当我在我的应用程序中包含这个库时,我无法使用这些第三方库。我阅读了以下文章第 1 条第 2 条 并尝试了
1. compile project(':library-name')
{将库的 .aar 文件作为模块导入到 myproject 中之后}
2. 我将 .aar 文件包含在 libs 文件夹中并添加了以下依赖项

build.gradle(项目级别)

allprojects {
repositories {
    flatDir {
        dirs 'libs'
    }
}
}
Run Code Online (Sandbox Code Playgroud)

build.gradle(应用程序级别)

compile fileTree(dir: 'libs', include: ['*.jar'])
compile ('com.myapp.package:library-name:1.0.0@aar'){
transitive=true
}
Run Code Online (Sandbox Code Playgroud)

3. 与2类似,但在
build.gradle中(应用程序级别)

compile fileTree(dir: 'libs', include: ['*.jar'])
compile (name:'library-name', ext:'aar'){
transitive=true
}
Run Code Online (Sandbox Code Playgroud)

但是,我仍然无法使用我的库中存在的传递库。我收到以下异常。

java.lang.NoClassDefFoundError: Failed resolution of: Lcom/squareup/okhttp/MediaType;
Run Code Online (Sandbox Code Playgroud)

有人可以帮忙吗

编辑:
以下是我的库的 build.gradle

compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'

compile 'org.apache.httpcomponents:httpcore:4.4.4' …
Run Code Online (Sandbox Code Playgroud)

android gradle android-library android-studio android-gradle-plugin

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

无法在 android.support.v7.widget.GridLayout 中使用 columnCount 属性

我正在尝试使用columnCount属性,android.support.v7.widget.GridLayout但出现错误

错误:(2)在包中找不到属性“useDefaultMargins”的资源标识符

我用过了 xmlns:app="http://schemas.android.com/apk/res-auto

android widget grid-layout android-library android-support-library

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

部署到工件后不包括外部依赖

我开发了小型 mvp 库,其中包含一些依赖项,例如 butterknife 和 glide,但是在它已经部署到我的私有工件之后,我的库中不包含所有依赖项,因此在使用此库时,我的项目中未解决所有依赖项。我是这个神器的新手,我错过了什么吗?

这是我的根 build.gradle :

buildscript {
repositories {
    jcenter()
}
dependencies {
    classpath 'com.android.tools.build:gradle:2.2.3'

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
    classpath "org.jfrog.buildinfo:build-info-extractor-gradle:4.0.1"
    classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
   }
}

allprojects {
  repositories {
    jcenter()
  }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
Run Code Online (Sandbox Code Playgroud)

这是我的 build.gradle 模块:

apply plugin: 'com.android.library'
apply plugin: 'com.jfrog.artifactory'
apply plugin: 'maven-publish'
apply plugin: 'me.tatarka.retrolambda'

def libraryGroupId = 'com.pixilapps.pixilframework'
def libraryArtifactId = 'mvp' …
Run Code Online (Sandbox Code Playgroud)

android artifactory android-library

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

如何为多模块项目定义公共字符串和样式属性

我有一个非常大的 Android 应用程序模块。例如应用程序功能,我想将大模块划分为许多小模块。应用程序模块具有某些颜色、字符串和样式属性,这些属性需要在我正在创建的所有新模块之间通用。如何创建通用样式和字符串xml?

android android-library android-instant-apps

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

在Flutter项目上创建Android库

我正在尝试在flutter项目之上创建一个android库以进行分发。我使用flutter开发了一个应用程序,但我想将其包装在Android库中。我不断收到错误消息,Transform output file /Users/Dev/Documents/projects/LibExample/testlib/build/intermediates/flutter/flutter-x86.jar does not exist.我已经阅读了几乎所有在线搜索内容,但到目前为止没有任何内容。

LibExample是我使用该库的示例应用程序,而testlibAndroid库是该库。在中,testlib我已经设置好build.graddle要定位的flutter.sdk。我还指定了颤振源的位置。每次我sync创建gradle文件时,都会收到错误/Users/Dev/Documents/projects/LibExample/testlib/build/intermediates/flutter/flutter-x86.jar不存在。`

这是的输出flutter doctor -v

flutter doctor -v
[?] Flutter (Channel beta, v0.5.2-pre.1, on Mac OS X 10.13.6 17G65, locale en-US)
    • Flutter version 0.5.2-pre.1 at /Users/Dev/Downloads/flutter
    • Framework revision 142e2f41ba (9 weeks ago), 2018-09-03 12:50:53 +0100
    • Engine revision 1ed25ca7b7
    • Dart version 2.0.0-dev.58.0.flutter-f981f09760

[?] Android toolchain - develop for Android devices (Android SDK 28.0.3)
    • Android …
Run Code Online (Sandbox Code Playgroud)

android android-library flutter

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

使用Jake Wharton的ViewPageIndicator

我正在尝试在我的班级中使用ViewPageIndicator库,但遇到了困难.我从Git下载了库,使用库代码创建了一个新的Android项目,并且它充满了错误.我确保v4和v13的支持库存在,它可以减少相当多的错误,但Eclipse仍然会标记数百个错误.其中大多数是由于@Override这导致我相信我错过了一个支持库.GitHub页面上的安装说明尽可能模糊,只是提到将它作为库添加到您的项目中,仅此而已.那么我在这里缺少一些东西吗?

android android-library viewpagerindicator

0
推荐指数
1
解决办法
1785
查看次数

从图书馆项目到主项目的意图

当我尝试使用意图从主项目传递到库项目时,它工作正常,但是......当我尝试从库项目传递到主项目时,它无法识别主项目中的类。

我尝试在我的图书馆项目中写下这个意图:

Intent intent = new Intent(this,com.example.uploadvideo.class);
startActivity(intent);
Run Code Online (Sandbox Code Playgroud)

我将我想要连接的两个活动添加到主项目和库项目的清单中。

在此输入图像描述

android android-intent android-library

0
推荐指数
1
解决办法
3048
查看次数

如何在Android Studio中为我的项目添加外部库?

我想在我的项目中使用pagerslidingtabstrip.因为,它不是一个jar文件.我该如何导入?

我读了几篇文章,并对此作了答案,但它们都不清楚,所有这些都是过时的或复杂的.

我可以清楚地建议一下这些步骤吗?

android android-library android-studio pagerslidingtabstrip

0
推荐指数
1
解决办法
1575
查看次数

github上的所有android代码都可以免费使用

出于商业目的而未在我们的应用程序中提及其许可证?

例如android第三方库?

我可以在我的应用程序中使用Android第三方库而不显示其作者姓名吗?

我想使用第三方库,但不希望任何人知道他们的名字!

apache android licensing github android-library

-5
推荐指数
1
解决办法
812
查看次数