gpt4 book ai didi

android - 在 Android Studio 中使用 maven 模块

转载 作者:行者123 更新时间:2023-12-03 04:34:41 24 4
gpt4 key购买 nike

我的 android studio 中有一个 android 项目(gradl),我有一个 maven 模块,我想在我的 android 项目中使用。结构如下:

  • 安卓项目(gradle)
  • 子项目(gradle)
  • -- build.gradle
  • MyFancyStuff (gradle)
  • -- ...
  • build.gradle
  • settings.gradl
  • 共享模型(Maven 项目)
  • pom.xml
  • ...

  • 现在我调整了我的 settings.gradle如下:
    include ':MyFancyStuff',':shared-models'
    project(':shared-models').projectDir = new File('../shared-models')

    我从其他几个 stackoverflow 主题中得到了这个。

    现在 build.gradle子项目:
    apply plugin: 'com.android.library'

    android {
    compileSdkVersion 21
    buildToolsVersion "21.1.2"

    defaultConfig {
    minSdkVersion 18
    targetSdkVersion 21
    versionCode 1
    versionName "1.0"
    }
    buildTypes {
    release {
    minifyEnabled false
    proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
    }
    }

    dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'MyFancyStuff:MyFancyStuff-debug@aar'
    compile 'org.codehaus.jackson:jackson-mapper-asl:1.9.0'
    compile 'com.sun.jersey:jersey-client:1.9.1'
    compile 'com.google.code.gson:gson:1.7.2'
    compile project(':shared-models')
    }

    repositories{
    flatDir{
    dirs 'libs'
    }
    ivy {
    url "../shared-models"
    }
    }

    现在我收到以下错误:

    Error:Configuration with name 'default' not found.



    基于stackoverflow上的其他线程,我不知道问题所在......

    最佳答案

    Error:Configuration with name 'default' not found.



    这意味着 Gradle 正在寻找一个模块(或 build.gradle )文件,但它没有找到它。

    在您的情况下,问题应该是共享模型,它是一个 Maven 项目 pom.xml而不是 build.gradle文件。

    Gradle 不提供解析 POM 文件的原生支持,但 Groovy 的 XmlSlurper使 XML 解析变得简单方便。
    还要检查 link

    关于android - 在 Android Studio 中使用 maven 模块,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35065330/

    24 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com