Skip to content
This repository has been archived by the owner on Nov 9, 2022. It is now read-only.

android_core catkin_make stuck at "0% CONFIGURING root project" #282

Closed
DEQDON opened this issue May 17, 2018 · 7 comments
Closed

android_core catkin_make stuck at "0% CONFIGURING root project" #282

DEQDON opened this issue May 17, 2018 · 7 comments

Comments

@DEQDON
Copy link

DEQDON commented May 17, 2018

Hi, I'm new to rosjava and rosandroid. When I'm trying to build android_core (I want to use android_tutorial_camera), the catkin_make stuck at "0% CONFIGURING root project".

My computer is ubuntu 16.04.2, and my ROS is kinetic. The android Sdk and android studio are all ready.

The procedure I'm following is from http://wiki.ros.org/android/Tutorials/kinetic/Installation%20-%20ROS%20Development%20Environment . The rosjava is installed via deb installation from http://wiki.ros.org/rosjava/Tutorials/kinetic/Deb%20Installation

FYI, I encontered failure of downloading gradle-3.5.1-bin.zip before I met this. And I solved it by mannually downloading it and modifying the gradle-wrapper.properties to use the downloaded file.

The terminal output of my catkin_make is as follows:

When it's stuck, the terminal shows:

don@Deck:~/android_core$ catkin_make
Base path: /home/don/android_core
Source space: /home/don/android_core/src
Build space: /home/don/android_core/build
Devel space: /home/don/android_core/devel
Install space: /home/don/android_core/install
####
#### Running command: "make cmake_check_build_system" in "/home/don/android_core/build"
####
####
#### Running command: "make -j4 -l4" in "/home/don/android_core/build"
####
<-------------> 0% CONFIGURING
> root project

After 10 minutes, the catkin_make failed, and the terminal shows:

don@Deck:~/android_core$ catkin_make
Base path: /home/don/android_core
Source space: /home/don/android_core/src
Build space: /home/don/android_core/build
Devel space: /home/don/android_core/devel
Install space: /home/don/android_core/install
####
#### Running command: "make cmake_check_build_system" in "/home/don/android_core/build"
####
####
#### Running command: "make -j4 -l4" in "/home/don/android_core/build"
####

FAILURE: Build failed with an exception.

* Where:
Script '/home/don/android_core/src/android_core/buildscript.gradle' line: 19

* What went wrong:
A problem occurred evaluating script.
> Could not read script 'https://raw.githubusercontent.com/rosjava/rosjava_bootstrap/kinetic/buildscript.gradle'.
   > Unexpected end of file from server

* 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: 10 mins 5.529 secs
android_core/CMakeFiles/gradle-android_core.dir/build.make:57: recipe for target 'android_core/CMakeFiles/gradle-android_core' failed
make[2]: *** [android_core/CMakeFiles/gradle-android_core] Error 1
CMakeFiles/Makefile2:447: recipe for target 'android_core/CMakeFiles/gradle-android_core.dir/all' failed
make[1]: *** [android_core/CMakeFiles/gradle-android_core.dir/all] Error 2
Makefile:138: recipe for target 'all' failed
make: *** [all] Error 2
Invoking "make -j4 -l4" failed

I'm looking forward to any kind of help. Thank you for your time!

@jubeira
Copy link

jubeira commented May 21, 2018

hi @DEQDON,

The failure downloading Gradle could be related to the JDK version you have installed. Are you using Java 8? Take a look at this issue for reference: rosjava/rosjava_core#252.

Regarding the second failure, Gradle is using a buildscript hosted on Github (see error message under What went wrong, and this URL: https://raw.githubusercontent.com/rosjava/rosjava_bootstrap/kinetic/buildscript.gradle).
If that URL is unreachable or if there's a problem with Github when you are building, you may get that error. Can you see the file in your browser if you follow the link?

@DEQDON
Copy link
Author

DEQDON commented May 22, 2018

@jubeira Thanks for your reply!

Regarding the first problem, yes, I am using Java 8. I have just installed Oracle JDK 8 and uninstalled Open JDK 8 due to some suggestions which I cannot find the source now. But I still can't get the download process going.

Regarding the second problem, yes, I can see the file in the link. It's listed below:

/*
 * Copyright (C) 2014 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */

rootProject.buildscript {
    String rosMavenPath = System.getenv("ROS_MAVEN_PATH")
    String rosMavenRepository = System.getenv("ROS_MAVEN_REPOSITORY")
    repositories {
        if (rosMavenPath != null) {
            rosMavenPath.tokenize(":").each { path ->
                maven {
                    // We can't use uri() here because we aren't running inside something
                    // that implements the Script interface.
                    url "file:${path}"
                }
            }
        }
        maven {
            url "http://repository.springsource.com/maven/bundles/release"
        }
        maven {
            url "http://repository.springsource.com/maven/bundles/external"
        }
        if (rosMavenRepository != null) {
            maven {
                url rosMavenRepository
            }
        }
        maven {
            url "https://github.com/rosjava/rosjava_mvn_repo/raw/master"
        }
        jcenter()
    }
    dependencies {
        classpath "org.ros.rosjava_bootstrap:gradle_plugins:[0.3,0.4)"
    }
}

@DEQDON
Copy link
Author

DEQDON commented May 23, 2018

@jubeira Hi, I want to provide some update on my problem.

I solved the issue by modifying java proxy, namely modifying the http and https proxy properties in the file "/usr/lib/jvm/java-8-oracle/jre/lib/net.properties" as well as modifying the network proxy properties in "javaws -version" in the terminal.

Thanks so much for your pointing out the network problem. I have to say that I am doing this in China, and the network connection problem with Java was unprecedented to me and was really frustrating. This single problem took me 6 days.

So the download is smooth now. Plenty of files are downloaded.

However, when it comes to building the examples, some other errors popped out. Take "android_tutorial_camera" for example, it has the following error:

:android_tutorial_camera:preBuild UP-TO-DATE
:android_tutorial_camera:preReleaseBuild UP-TO-DATE
:android_tutorial_camera:checkReleaseManifest
:android_tutorial_camera:preDebugBuild UP-TO-DATE
:android_tutorial_camera:prepareComAndroidSupportAnimatedVectorDrawable2510Library
:android_tutorial_camera:prepareComAndroidSupportAppcompatV72510Library
:android_tutorial_camera:prepareComAndroidSupportSupportCompat2510Library
:android_tutorial_camera:prepareComAndroidSupportSupportCoreUi2510Library
:android_tutorial_camera:prepareComAndroidSupportSupportCoreUtils2510Library
:android_tutorial_camera:prepareComAndroidSupportSupportFragment2510Library
:android_tutorial_camera:prepareComAndroidSupportSupportMediaCompat2510Library
:android_tutorial_camera:prepareComAndroidSupportSupportV42510Library
:android_tutorial_camera:prepareComAndroidSupportSupportVectorDrawable2510Library
:android_tutorial_camera:prepareReleaseDependencies
:android_tutorial_camera:compileReleaseAidl
:android_tutorial_camera:compileReleaseRenderscript
:android_tutorial_camera:generateReleaseBuildConfig
:android_tutorial_camera:generateReleaseResValues
:android_tutorial_camera:generateReleaseResources
:android_tutorial_camera:mergeReleaseResources
:android_tutorial_camera:processReleaseManifest
:android_tutorial_camera:processReleaseResources
:android_tutorial_camera:generateReleaseSources
:android_tutorial_camera:incrementalReleaseJavaCompilationSafeguard
:android_tutorial_camera:javaPreCompileRelease
:android_tutorial_camera:compileReleaseJavaWithJavac
:android_tutorial_camera:compileReleaseJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).
Note: /home/don/android_core/src/android_core/android_tutorial_camera/src/org/ros/android/android_tutorial_camera/MainActivity.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
:android_tutorial_camera:compileReleaseNdk NO-SOURCE
:android_tutorial_camera:compileReleaseSources
:android_tutorial_camera:lintVitalRelease
/home/don/android_core/src/android_core/android_10/src/org/ros/android/NodeMainExecutorService.java:115: Error: The WIFI_SERVICE must be looked up on the Application context or memory will leak on devices < Android N. Try changing  to .getApplicationContext()  [WifiManagerLeak]
    WifiManager wifiManager = (WifiManager) getSystemService(WIFI_SERVICE);
                                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

   Explanation for issues of type "WifiManagerLeak":
   On versions prior to Android N (24), initializing the WifiManager via
   Context#getSystemService can cause a memory leak if the context is not the
   application context. Change context.getSystemService(...) to
   context.getApplicationContext().getSystemService(...).

1 errors, 0 warnings
:android_tutorial_camera:mergeReleaseShaders
:android_tutorial_camera:compileReleaseShaders
:android_tutorial_camera:generateReleaseAssets
:android_tutorial_camera:mergeReleaseAssets
:android_tutorial_camera:transformClassesWithDexForRelease

Running dex as a separate process.

To run dex in process, the Gradle daemon needs a larger heap.
It currently has 914 MB.
For faster builds, increase the maximum heap size for the Gradle daemon to at least 1536 MB.
To do this set org.gradle.jvmargs=-Xmx1536M in the project gradle.properties.
For more information see https://docs.gradle.org/current/userguide/build_environment.html

:android_tutorial_camera:mergeReleaseJniLibFolders
:android_tutorial_camera:transformNativeLibsWithMergeJniLibsForRelease
:android_tutorial_camera:processReleaseJavaRes NO-SOURCE
:android_tutorial_camera:transformResourcesWithMergeJavaResForRelease
:android_tutorial_camera:packageRelease
:android_tutorial_camera:assembleRelease

The other examples suffer the same "WIFI_SERVICE" error when building.

And finally, the catkin_make fails with the last several lines showing:

:android_tutorial_teleop:mergeReleaseJniLibFolders
:android_tutorial_teleop:transformNativeLibsWithMergeJniLibsForRelease
:android_tutorial_teleop:processReleaseJavaRes NO-SOURCE
:android_tutorial_teleop:transformResourcesWithMergeJavaResForRelease
:android_tutorial_teleop:packageRelease
:android_tutorial_teleop:assembleRelease
:docs:assembleRelease UP-TO-DATE
:android_10:uploadArchives
Could not transfer artifact org.ros.android_core:android_10:aar:0.3.3 from/to remote (file:///opt/ros/kinetic/share/maven): Specified destination directory cannot be created: /opt/ros/kinetic/share/maven/org/ros/android_core/android_10/0.3.3
Could not transfer artifact org.ros.android_core:android_10:pom:0.3.3 from/to remote (file:///opt/ros/kinetic/share/maven): Specified destination directory cannot be created: /opt/ros/kinetic/share/maven/org/ros/android_core/android_10/0.3.3
:android_10:uploadArchives FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':android_10:uploadArchives'.
> Could not publish configuration 'archives'
   > Failed to deploy artifacts: Could not transfer artifact org.ros.android_core:android_10:aar:0.3.3 from/to remote (file:///opt/ros/kinetic/share/maven): Specified destination directory cannot be created: /opt/ros/kinetic/share/maven/org/ros/android_core/android_10/0.3.3

* 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: 13 mins 19.769 secs
android_core/CMakeFiles/gradle-android_core.dir/build.make:57: recipe for target 'android_core/CMakeFiles/gradle-android_core' failed
make[2]: *** [android_core/CMakeFiles/gradle-android_core] Error 1
CMakeFiles/Makefile2:447: recipe for target 'android_core/CMakeFiles/gradle-android_core.dir/all' failed
make[1]: *** [android_core/CMakeFiles/gradle-android_core.dir/all] Error 2
Makefile:138: recipe for target 'all' failed
make: *** [all] Error 2
Invoking "make -j4 -l4" failed

Could you please give me some instructions on this new issue?

@jubeira
Copy link

jubeira commented May 23, 2018

@DEQDON thanks for sharing that info; it may be useful for other users in China as well.

About the new issue, I would check the build tools version that you are using. I think 25.0.2 is the latest one I've tried; in some cases newer build tools may flag warnings as errors.

Do you need the latest build tools? Can you try downgrading them? Another option would be following the suggestion in the error in android_core sources.

And the last one is a permission failure. When you build an android projects, the resulting artifacts should be placed under devel folder, but somehow in your case it's targeting /opt/... which probably needs admin privileges.

@DEQDON
Copy link
Author

DEQDON commented May 24, 2018

@jubeira The problems are all solved now. Thank you so much for your help!

Here's a summary of the experiences for the issues I met.

Firstly, the network connection must be taken care of. I'm using shadowsocks for system proxy, but it doesn't work for java in the terminal. So I need to modify the java proxy properties as mentioned above. I might need to configure a global VPN later :)

Secondly, regarding the "WIFI_SERVICE" error when building the examples, I am using a newer version 26.0.0 of build tool than 25.0.2 that you suggested. But the problem is easy to solve, I just go into android_core/src/android_core/android_10/src/org/ros/android/NodeMainExecutorService.java:115: and modified

WifiManager wifiManager = (WifiManager) getSystemService(WIFI_SERVICE);

to

WifiManager wifiManager = (WifiManager) getApplicationContext().getgetSystemService(WIFI_SERVICE);

as the build tool suggested.

Lastly, the "Could not transfer artifact" is truly because of permission failure. I have found that the CMakelists.txt in android_core/src/ is linked to /opt/ros/kinetic/share/catkin/cmake/toplevel.cmake and the results do need to be transfered to /opt/ros/kinetic/share/... . Therefore, I changed the permission previlege of /opt/ros/kinetic and it goes successfully.

The android_tutorial_camera I need works fine now. Thank you again for your kind help!

@DEQDON DEQDON closed this as completed May 24, 2018
@ghost
Copy link

ghost commented Oct 15, 2018

@DEQDON
Hello,

I am also getting the same error:
`* What went wrong:
A problem occurred evaluating script.

Could not read script 'https://github.com/rosjava/rosjava_bootstrap/raw/kinetic/buildscript.gradle'.
Connection reset
`

I believe you solved the problem by changing proxies. Can you share the file? How did you change the files proxies "net.properties" and how or what changes in "javaws -version".

Please Note, i have openjdk-8 .

@DEQDON
Copy link
Author

DEQDON commented Oct 27, 2018

@letsdoitagain
I'm sorry for the late reply.
First, I changed my Java version to Oracle JDK, deleting OpenJDK.
In "net.properties", I used polipo for terminal proxy, so I changed the http and https proxy attributes to my polipo proxy address and port.
In "javaws -viewer", I changed "Network Settings" also to my polipo address and port.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants