如何在我的Codename One Android应用程序中将依赖项添加到根级build.gradle文件?

时间:2017-09-12 18:55:16

标签: android firebase codenameone

我已经添加了android.gradleDep构建提示,并为我想要集成的第三方库添加了正确的“compile'....'”提示。 (在这种情况下,Firebase)。

在Codename One Android应用中的根级build.gradle文件中,我该怎么做:

  1. 将一个类路径依赖项添加到buildscript部分?
  2. 在allprojects部分添加maven依赖项?
  3. 修改 第3。添加插件,例如:apply plugin: 'com.google.gms.google-services'

    视觉示例:

        buildscript {
             dependencies {
                 classpath 'com.google.gms:google-services:3.1.0' // google-services plugin
             }
        }
    
        allprojects {
            dependencies {
                maven {
                    url "https://maven.google.com" // Google's Maven repository
               } 
            }
        }
    

    我查看了CN1's page on Build hints,但不知道下一步要导入此库。如果没有这些更改,我会收到以下构建错误:

    Resource missing. [HTTP GET: https://jcenter.bintray.com/com/google/firebase/firebase-
    core/11.2.0/firebase-core-11.2.0.pom]
    Resource missing. [HTTP HEAD: https://jcenter.bintray.com/com/google/firebase/firebase-
    core/11.2.0/firebase-core-11.2.0.jar]
    
    FAILURE: Build failed with an exception.
    
    * What went wrong:
    A problem occurred configuring root project 'MyApp'.
    > Could not resolve all dependencies for configuration ':_debugCompile'.
    > Could not find com.google.firebase:firebase-core:11.2.0.
     Searched in the following locations:
         https://jcenter.bintray.com/com/google/firebase/firebase-core/11.2.0/firebase-core-11.2.0.pom
         https://jcenter.bintray.com/com/google/firebase/firebase-core/11.2.0/firebase-core-11.2.0.jar
         file:/tmp/build1801628445736809063xxx/MyApp/libs/firebase-core-11.2.0.jar
         file:/tmp/build1801628445736809063xxx/MyApp/libs/firebase-core.jar
         file:/home/ec2-user/android-sdk/extras/android/m2repository/com/google/firebase/firebase-core/11.2.0/firebase-core-11.2.0.pom
         file:/home/ec2-user/android-sdk/extras/android/m2repository/com/google/firebase/firebase-core/11.2.0/firebase-core-11.2.0.jar
         file:/home/ec2-user/android-sdk/extras/google/m2repository/com/google/firebase/firebase-core/11.2.0/firebase-core-11.2.0.pom
         file:/home/ec2-user/android-sdk/extras/google/m2repository/com/google/firebase/firebase-core/11.2.0/firebase-core-11.2.0.jar
    

    编辑在.properties文件中,我有:

      codename1.arg.android.repositories=maven { url "https\://maven.google.com" };
    
      codename1.arg.android.gradleDep=compile 'com.google.gms\:google-services\:3.1.0', compile 'com.google.firebase\:firebase-core\:11.2.0'
    

    我收到以下错误消息:

    FAILURE: Build failed with an exception.
    
    * Where:
     Build file '/tmp/build1791213618910744158xxx/MyApp/build.gradle' line: 78
    
    * What went wrong:
    A problem occurred evaluating root project 'MyApp'.
     > Could not find property 'compile' on org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler_Decorated@59ed76e3.
    

1 个答案:

答案 0 :(得分:3)

您也可以添加指向您的repo URL的构建提示。在你的情况下:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.18.1/moment.min.js"></script>

<input type="number" id="inputmonthadded">
<input type="text" id="inputstartdate" value="12-September-2017" readonly>
<input type="text" id="inputportalexpirydate" readonly>
<input type="text" id="inputmonthpurchased">