[ 
https://issues.apache.org/jira/browse/CB-9520?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

ZhangYuan updated CB-9520:
--------------------------
    Description: 
I am trying to do 'cordova build android' in a multiply project and got a 
strage problem which I cannot find any answer in stackoverflow.
Would you please help me ?
My projects structure like :
  
      android(MainApp)
      |-- build.gradle
      |-- setting.gradle
      |-- gradle.properties
      |--LibProject1
         |-- build.gradle
         |-- setting.gradle
         |-- gradle.properties
      |--LibProject2
         |-- build.gradle
         |-- setting.gradle
         |-- gradle.properties
      |--LibProject3
         |-- build.gradle
         |-- setting.gradle
         |-- gradle.properties
             |--LibProject3_1
             |-- build.gradle
             |-- setting.gradle
             |-- gradle.properties

'cordova prepare android' and 'cordova plugins' run successfully, but 'cordova 
build android' failed in very long and strange error:

----------------------------------------------------------------------------------------------
    Running command: ******\platforms\android\cordova\build.bat
    ANDROID_HOME=*****
    JAVA_HOME=*****
    Running: ******android\gradlew cdvBuildDebug -b 
****platforms\android\build.gradle -Dorg.gradle.daemon=true
    Failed to notify ProjectEvaluationListener.afterEvaluate(), but primary 
configuration failure takes
    precedence.
    java.lang.IllegalStateException: buildToolsVersion is not specified.
        at 
com.google.common.base.Preconditions.checkState(Preconditions.java:176)
        at 
com.android.build.gradle.BasePlugin.createAndroidTasks(BasePlugin.groovy:444)
        at 
com.android.build.gradle.BasePlugin$_createTasks_closure13_closure17.doCall(BasePlugin.groovy:415)
        at 
com.android.build.gradle.BasePlugin$_createTasks_closure13_closure17.doCall(BasePlugin.groovy)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at 
org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
        at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:324)

    FAILURE: Build failed with an exception.

    * Where:
    Build file '*****platforms\android\LibProject1\build.gradle' line: 49

    * What went wrong:
    A problem occurred evaluating project ':LibProject1'.
    > Project with path ':LibProject3' could not be found in project 
':LibProject1'.

    * Try:
    Run with --stacktrace option to get the stack trace. Run with --info or 
--debug option to get more log output.

    BUILD FAILED

    Total time: 2.142 secs

    ******platforms\android\cordova\node_modules\q\q.js:126
                    throw e;
                          ^
   Error code 1 for command: cmd with args: /s /c 
"******\platforms\android\gradlew cdvBuildDebug -b 
    ******\platforms\android\build.gradle -Dorg.gradle.daemon=true"
    Error: ******platforms\android\cordova\build.bat: Command failed with exit 
code 8
          at ChildProcess.whenDone 
(****AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\src\cordova\superspawn.js:135:23)
          at ChildProcess.emit (events.js:98:17)
          at maybeClose (child_process.js:766:16)
          at Process.ChildProcess._handle.onexit (child_process.js:833:5)
----------------------------------------------------------------------------------------------
  
seems it said my LibProject1/build.gradle has some wrong but 'gradle build' 
successed and I got apk run normally. 

finally I found that when 'cordova build android' ran, file 
LibProject1/build.gradle is being changed auto. for example: 

    dependencies{
     compile project(':LibProject2')
    }

is changed to 

   dependencies{
     debugCompile project(path: ":LibProject3", configuration: "debug")

     releaseCompile project(path: ":LibProject3", configuration: "release")
    }
I am realy confuse with this problem. 

  was:
I am trying to do 'cordova build android' in a multiply project and got a 
strage problem which I cannot find any answer in stackoverflow.
Would you please help me ?
My projects structure like :
  
    android(MainApp)
    |-- build.gradle
    |-- setting.gradle
    |-- gradle.properties
    |--LibProject1
       |-- build.gradle
       |-- setting.gradle
       |-- gradle.properties
    |--LibProject2
       |-- build.gradle
       |-- setting.gradle
       |-- gradle.properties
    |--LibProject3
       |-- build.gradle
       |-- setting.gradle
       |-- gradle.properties
          |--LibProject3_1
          |-- build.gradle
          |-- setting.gradle
          |-- gradle.properties

'cordova prepare android' and 'cordova plugins' run successfully, but 'cordova 
build android' failed in very long and strange error:

----------------------------------------------------------------------------------------------
    Running command: ******\platforms\android\cordova\build.bat
    ANDROID_HOME=*****
    JAVA_HOME=*****
    Running: ******android\gradlew cdvBuildDebug -b 
****platforms\android\build.gradle -Dorg.gradle.daemon=true
    Failed to notify ProjectEvaluationListener.afterEvaluate(), but primary 
configuration failure takes
    precedence.
    java.lang.IllegalStateException: buildToolsVersion is not specified.
        at 
com.google.common.base.Preconditions.checkState(Preconditions.java:176)
        at 
com.android.build.gradle.BasePlugin.createAndroidTasks(BasePlugin.groovy:444)
        at 
com.android.build.gradle.BasePlugin$_createTasks_closure13_closure17.doCall(BasePlugin.groovy:415)
        at 
com.android.build.gradle.BasePlugin$_createTasks_closure13_closure17.doCall(BasePlugin.groovy)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at 
org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
        at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:324)

    FAILURE: Build failed with an exception.

    * Where:
    Build file '*****platforms\android\LibProject1\build.gradle' line: 49

    * What went wrong:
    A problem occurred evaluating project ':LibProject1'.
    > Project with path ':LibProject3' could not be found in project 
':LibProject1'.

    * Try:
    Run with --stacktrace option to get the stack trace. Run with --info or 
--debug option to get more log output.

    BUILD FAILED

    Total time: 2.142 secs

    ******platforms\android\cordova\node_modules\q\q.js:126
                    throw e;
                          ^
   Error code 1 for command: cmd with args: /s /c 
"******\platforms\android\gradlew cdvBuildDebug -b 
    ******\platforms\android\build.gradle -Dorg.gradle.daemon=true"
    Error: ******platforms\android\cordova\build.bat: Command failed with exit 
code 8
          at ChildProcess.whenDone 
(****AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\src\cordova\superspawn.js:135:23)
          at ChildProcess.emit (events.js:98:17)
          at maybeClose (child_process.js:766:16)
          at Process.ChildProcess._handle.onexit (child_process.js:833:5)
----------------------------------------------------------------------------------------------
  
seems it said my LibProject1/build.gradle has some wrong but 'gradle build' 
successed and I got apk run normally. 

finally I found that when 'cordova build android' ran, file 
LibProject1/build.gradle is being changed auto. for example: 

    dependencies{
     compile project(':LibProject2')
    }

is changed to 

   dependencies{
     debugCompile project(path: ":LibProject3", configuration: "debug")
     releaseCompile project(path: ":LibProject3", configuration: "release")
    }
I am realy confuse with this problem. 


> A strage proble while running 'cordova build android' in multiply project
> -------------------------------------------------------------------------
>
>                 Key: CB-9520
>                 URL: https://issues.apache.org/jira/browse/CB-9520
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: Android, CordovaLib
>    Affects Versions: 4.1.1
>         Environment: windows 8.1 Pro 64bit, 
> Android SDK Build-tools 23.0.0, 
> Gradle 2.4, 
> JDK1.7.
> cordova 4.1.2
>            Reporter: ZhangYuan
>              Labels: build
>   Original Estimate: 672h
>  Remaining Estimate: 672h
>
> I am trying to do 'cordova build android' in a multiply project and got a 
> strage problem which I cannot find any answer in stackoverflow.
> Would you please help me ?
> My projects structure like :
>   
>       android(MainApp)
>       |-- build.gradle
>       |-- setting.gradle
>       |-- gradle.properties
>       |--LibProject1
>          |-- build.gradle
>          |-- setting.gradle
>          |-- gradle.properties
>       |--LibProject2
>          |-- build.gradle
>          |-- setting.gradle
>          |-- gradle.properties
>       |--LibProject3
>          |-- build.gradle
>          |-- setting.gradle
>          |-- gradle.properties
>              |--LibProject3_1
>              |-- build.gradle
>              |-- setting.gradle
>              |-- gradle.properties
> 'cordova prepare android' and 'cordova plugins' run successfully, but 
> 'cordova build android' failed in very long and strange error:
> ----------------------------------------------------------------------------------------------
>     Running command: ******\platforms\android\cordova\build.bat
>     ANDROID_HOME=*****
>     JAVA_HOME=*****
>     Running: ******android\gradlew cdvBuildDebug -b 
> ****platforms\android\build.gradle -Dorg.gradle.daemon=true
>     Failed to notify ProjectEvaluationListener.afterEvaluate(), but primary 
> configuration failure takes
>     precedence.
>     java.lang.IllegalStateException: buildToolsVersion is not specified.
>         at 
> com.google.common.base.Preconditions.checkState(Preconditions.java:176)
>         at 
> com.android.build.gradle.BasePlugin.createAndroidTasks(BasePlugin.groovy:444)
>         at 
> com.android.build.gradle.BasePlugin$_createTasks_closure13_closure17.doCall(BasePlugin.groovy:415)
>         at 
> com.android.build.gradle.BasePlugin$_createTasks_closure13_closure17.doCall(BasePlugin.groovy)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>         at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:597)
>         at 
> org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
>         at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:324)
>     FAILURE: Build failed with an exception.
>     * Where:
>     Build file '*****platforms\android\LibProject1\build.gradle' line: 49
>     * What went wrong:
>     A problem occurred evaluating project ':LibProject1'.
>     > Project with path ':LibProject3' could not be found in project 
> ':LibProject1'.
>     * Try:
>     Run with --stacktrace option to get the stack trace. Run with --info or 
> --debug option to get more log output.
>     BUILD FAILED
>     Total time: 2.142 secs
>     ******platforms\android\cordova\node_modules\q\q.js:126
>                     throw e;
>                           ^
>    Error code 1 for command: cmd with args: /s /c 
> "******\platforms\android\gradlew cdvBuildDebug -b 
>     ******\platforms\android\build.gradle -Dorg.gradle.daemon=true"
>     Error: ******platforms\android\cordova\build.bat: Command failed with 
> exit code 8
>           at ChildProcess.whenDone 
> (****AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\src\cordova\superspawn.js:135:23)
>           at ChildProcess.emit (events.js:98:17)
>           at maybeClose (child_process.js:766:16)
>           at Process.ChildProcess._handle.onexit (child_process.js:833:5)
> ----------------------------------------------------------------------------------------------
>   
> seems it said my LibProject1/build.gradle has some wrong but 'gradle build' 
> successed and I got apk run normally. 
> finally I found that when 'cordova build android' ran, file 
> LibProject1/build.gradle is being changed auto. for example: 
>     dependencies{
>      compile project(':LibProject2')
>     }
> is changed to 
>    dependencies{
>      debugCompile project(path: ":LibProject3", configuration: "debug")
>      releaseCompile project(path: ":LibProject3", configuration: "release")
>     }
> I am realy confuse with this problem. 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to