Unable to get mutable windows environment variable map

When I try to run ./gradlew assembleDebug I get ‘Unable to get mutable Windows environment variable map’. I’ve done a bit of googling and can’t seem to find very much on this.

Anyone have any ideas as to what’s causing it? This is the error when I run with debug

17:13:11.598 [DEBUG] [org.gradle.launcher.daemon.client.DaemonClient] Connected to daemon DaemonInfo{pid=2956, address=[52549c50-6c6f-42f1-9f07-78b85bf8f335 port:56648, addresses:[/127.0.0.1, /0:0:0:0:0:0:0:1]], state=Idle, lastBusy=1643908195400, context=DefaultDaemonContext[uid=911f7aaa-67be-44a1-a676-ede7fcfddaac,javaHome=C:\Program Files\Java\jdk-17.0.2,daemonRegistryDir=C:\Users\rzakh.gradle\daemon,pid=2956,idleTimeout=10800000,daemonOpts=—add-opens,java.base/java.util=ALL-UNNAMED,-Xmx1536m,-Dfile.encoding=windows-1252,-Duser.country=GB,-Duser.language=en,-Duser.variant]}. Dispatching request Build{id=08809cd8-1670-4b6d-967c-185b1539b10b, currentDir=C:\Users\rzakh\Desktop\Mario64\sm64-port-android-base}.
17:13:11.599 [DEBUG] [org.gradle.launcher.daemon.client.DaemonClientConnection] thread 1: dispatching class org.gradle.launcher.daemon.protocol.Build
17:13:11.605 [DEBUG] [org.gradle.launcher.daemon.client.DaemonClient] Received result org.gradle.launcher.daemon.protocol.BuildStarted@5f20155b from daemon DaemonInfo{pid=2956, address=[52549c50-6c6f-42f1-9f07-78b85bf8f335 port:56648, addresses:[/127.0.0.1, /0:0:0:0:0:0:0:1]], state=Idle, lastBusy=1643908195400, context=DefaultDaemonContext[uid=911f7aaa-67be-44a1-a676-ede7fcfddaac,javaHome=C:\Program Files\Java\jdk-17.0.2,daemonRegistryDir=C:\Users\rzakh.gradle\daemon,pid=2956,idleTimeout=10800000,daemonOpts=—add-opens,java.base/java.util=ALL-UNNAMED,-Xmx1536m,-Dfile.encoding=windows-1252,-Duser.country=GB,-Duser.language=en,-Duser.variant]} (build should be starting).
17:13:11.623 [DEBUG] [org.gradle.launcher.daemon.client.DaemonClientInputForwarder] Dispatching close input message: org.gradle.launcher.daemon.protocol.CloseInput@4e810a4e
17:13:11.624 [DEBUG] [org.gradle.launcher.daemon.client.DaemonClientConnection] thread 19: dispatching class org.gradle.launcher.daemon.protocol.CloseInput
17:13:11.625 [DEBUG] [org.gradle.launcher.daemon.client.DaemonClient] Received result Failure[value=net.rubygrapefruit.platform.NativeException: Unable to get mutable Windows environment variable map] from daemon DaemonInfo{pid=2956, address=[52549c50-6c6f-42f1-9f07-78b85bf8f335 port:56648, addresses:[/127.0.0.1, /0:0:0:0:0:0:0:1]], state=Idle, lastBusy=1643908195400, context=DefaultDaemonContext[uid=911f7aaa-67be-44a1-a676-ede7fcfddaac,javaHome=C:\Program Files\Java\jdk-17.0.2,daemonRegistryDir=C:\Users\rzakh.gradle\daemon,pid=2956,idleTimeout=10800000,daemonOpts=—add-opens,java.base/java.util=ALL-UNNAMED,-Xmx1536m,-Dfile.encoding=windows-1252,-Duser.country=GB,-Duser.language=en,-Duser.variant]} (build should be done).
17:13:11.625 [DEBUG] [org.gradle.launcher.daemon.client.DaemonClientConnection] thread 1: dispatching class org.gradle.launcher.daemon.protocol.Finished
17:13:11.625 [DEBUG] [org.gradle.launcher.daemon.client.DaemonClientConnection] thread 1: connection stop
17:13:11.634 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]

Пытаюсь собрать приложение, получаю

To honour the JVM settings for this build a new JVM will be forked. Please consider using the daemon: https://docs.gradle.org/4.10.1/userguide/gradle_daemon.html.

FAILURE: Build failed with an exception.

* What went wrong:

Unable to get mutable Windows environment variable map

Параметры такие:

[info] Android ARM 64 (Gradle)

[info] Дата и время начала сборки: 20.04.2021 16:01:35

[info] Файловый вариант ИБ       : Нет

[info] Версия ОС                 : Windows x86-64, Microsoft Windows 7 version 6.1 Service Pack 1 (Build 7601)

[info] Оперативная память        : 122 879

[info] Версия 1С:Предприятия     : 8.3.15.1830 Windows x86-64

[info] Версия сборщика           : 2.0.10.77

[info] Версия мобильной платформы: 8.3.16.142

[info] Тип сборки                : app

[info] Графическая информация    :

[info] Аудиоинформация           :

[info] Путь к Android SDK        : C:\Mobile\SDK

[info] Android API Level         : 30

[info] Путь к Java               : C:\Program Files\Java\jdk-16

[info] Версия Java               : java version «16» 2021-03-16

[info] Архитектура Java          : 64

[info] Рабочий каталог (и кеш)   : C:\Mobile\TEMP

Подскажите коллеги где искать решение проблемы

Flutter Tutorial – How to Migrate to V2 Embedding

If you hopped on the Flutter bandwagon in it’s early days, most likely you have a project or two that were created prior to version 1.12 of Flutter. If that is the case, you may have seen this message whenever you run Pub get in one of your projects:

This app is using a deprecated version of the Android embedding.
To avoid unexpected runtime failures, or future build failures, try to migrate this app to the V2 embedding.

Take a look at the docs for migrating an app: https://github.com/flutter/flutter/wiki/Upgrading-pre-1.12-Android-projects

Now, the document itself has the steps you need to follow to make this warning disappear, but it does not always clarify what to change and where.

This article will give you a step by step walkthrough on migrating your Flutter application to V2 Embedding so you can make that warning go away for good.

Automatic Migration – The Easy Way Out

It needs to be said that you can forego this process of migration if your application can be easily recreated. So what does that mean?

Well, if the code in your application is not complex, then you can just save the files in your lib folder and create a new project using flutter create. That way, you will have a project that is already migrated to V2 Embedding and will just need to copy paste the code you have in your lib folder.

But, if your project is more complex – let’s say it’s a package that has platform specific code – you will probably be better off by migrating it manually.

Manual Migration – Follow These Steps

  1. Open the MainActivity.kt (or .java) file in your application
  2. You need to remove any content this file has and just leave it bare with a class declaration (unless you have specific logic there).
  3. Remove all of the imports and make sure to have one import that is this:
import io.flutter.embedding.android.FlutterActivity;

The end result should be as follows:

import io.flutter.embedding.android.FlutterActivity;
public class MainActivity extends FlutterActivity {   
    // Nothing should be here
}
  1. Open the AndroidManifest.xml file and change the name attribute under the application tag to ${applicationName} – so it looks like this:
<application      
    android:name="${applicationName}"> 
     .... 
</application>
  1. You need to add the following meta data inside your application tags:
<meta-data           
     android:name="flutterEmbedding"       
     android:value="2" />
  1. If you want a specific Splash screen behavior, you will need to remove the Splash screen meta tag:
<meta-data                     android:name="io.flutter.app.android.SplashScreenUntilFirstFrame"                android:value="true" />
  1. Then head to your styles.xml file and configure the LaunchTheme there with the drawable of your liking:
<?xml version="1.0" encoding="utf-8"?>
<resources>    
     <style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">        <item name="android:windowBackground">@drawable/launch_background
        </item>   
    </style>
</resources>

Your AndroidManifest.xml will look something like this after all the changes above:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"    package="PACKAGE_NAME">
<application        
    android:name="${applicationName}"    
    android:label="APPLICATION_LABEL"      
    android:icon="@mipmap/ic_launcher">     
        <activity           
            android:name=".MainActivity"
            android:exported="true"   
            android:launchMode="singleTop"     android:theme="@style/LaunchTheme"                android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"            android:hardwareAccelerated="true"            android:windowSoftInputMode="adjustResize">     
                <intent-filter>    
                    <action android:name="android.intent.action.MAIN"/>                                <category android:name="android.intent.category.LAUNCHER"/>  
                    </intent-filter>     
       </activity>     
       <meta-data       
               android:name="flutterEmbedding"         
            android:value="2" /> 
 </application>
</manifest>

AndroidX Support

Your project might also be needed to be migrated to use AndroidX libraries instead of the older support libraries. You will be alerted for this when you build and run your application:

Your app isn’t using AndroidX. To avoid potential build failures, you can quickly migrate your app by following the steps on https://goo.gl/CP92wY.

Fixing this is rather simple, as Android Studio has built in support for migrating to AndroidX.

Start by opening the Android folder of your Flutter application as a standalone project

Click on Refactor → Migrate to AndroidX:

Image

Dropdown menu to Migrate to AndroidX

You will then be prompted to save a copy of your project and past that, the migration process will take place.

Errors You Might See

During this migration process, you might encounter several errors when building your application. The most prominent ones are:

  • Unable to get mutable Windows environment variable map
  • cvc-complex-type.2.4.a: Invalid content was found starting with element ‘base-extension’. One of ‘{layoutlib}’ is expected
  • Warning: This version only understands SDK XML versions up to 2 but an SDK XML file of version 3 was encountered. This can happen if you use versions of Android Studio and the command-line tools that were released at different times

The first two errors are related to each other and both stem from the same root cause. It is because your project was set up with an old Gradle version and it is needed to upgrade it.

To do so, follow these steps:

  1. Open the Android folder in your Flutter application as a standalone project
  2. Click on File → Project Structure:

Image

Dropdown menu to select Project Structure

  1. Change the Gradle version to something more recent and that matches the current Android Studio version you are using

Image

AGP and Gradle settings screen

You could also use the AGP Upgrade Assistant to do this as well by going to Tools →AGP Upgrade Assistant:

Image

Dropdown menu to upgrade AGP using the AGP Upgrade Assistant

The third issue, which is a warning, might be caused by having an old version of the Android SDK Tools. To learn how to do that, you can go here.

Your project should be now fully migrated, compiling and running smoothly.

If you want to read other articles I have written, you can check them out here:



Learn to code for free. freeCodeCamp’s open source curriculum has helped more than 40,000 people get jobs as developers. Get started


Java Can T Run Gradlew Bat On Windows Stack Overflow

Java Can T Run Gradlew Bat On Windows Stack Overflow Your java home path should therefore read as c:\program files\java\jdk 17.0.1 not c:\program files\java\jdk 16.0.2\bin\java.exe. i would advise that you open your environment variables settings in the gui ststem properties part of your settings app, and check that all variables relevant to java, are pointing to the new and correct locations. The main problem though is, that you set the cwd for the process to the projectdir of the subproject instead of rootproject.projectdir and in the project dir of the subproject you don’t have a gradlew.bat as the error tells you.

Nativescript Gradlew Bat Failed With Exit Code 1 Stack Overflow

Nativescript Gradlew Bat Failed With Exit Code 1 Stack Overflow

Nativescript Gradlew Bat Failed With Exit Code 1 Stack Overflow Try running . gradlew stop to stop all daemons. then go in and delete the jdk folder. once that’s done, you don’t have to rerun the installer, you can actually just open it as a zip file (with like 7zip), go into the inner files.zip archive, and extract the jdk folder in there to replace the one you deleted. Basically, when called from a batch file with the daemon option, lots of different things can happen: if called from a cmd window (“gradle taskname”), everything seems to work as expected. if called inside a batch file, the cmd window is killed right after the gradle call, nothing after in the script is executed. I tried running gradlew.bat debug clean to check logs, but it hangs. checked task manager to see if java gradle is stuck in the background. killed any running gradle daemons ‘.\gradlew.bat stop’. Well, do as the error advised and run with stacktrace and or info to get more information? also, better provide copy & paste within code tag, instead of screenshots. related topics.

Java Command Failed Gradlew Bat Installdebug Stack Overflow

Java Command Failed Gradlew Bat Installdebug Stack Overflow I tried running gradlew.bat debug clean to check logs, but it hangs. checked task manager to see if java gradle is stuck in the background. killed any running gradle daemons ‘.\gradlew.bat stop’. Well, do as the error advised and run with stacktrace and or info to get more information? also, better provide copy & paste within code tag, instead of screenshots. related topics. As such, i can set the java home for my wsl shell by setting wslenv to java home up in the environment variables for my user account in windows. i can then run java.exe in my wsl shell to leverage my single windows jdk installation. When i run gradlew.bat test, it fails and jvm crashes. expected behavior. successfully run tests. context (optional) i can’t use gradle to build my project, whichever command prompt or android studio. steps to reproduce. clone github pascal lab tai e assignments enter a1\tai e\ folder run gradlew.bat clean test. If you are on windows you will need to use gradlew.bat from either command prompt or powershell. in most cases… you can run any provided java code with… or. the latter command executes the run target in the gradle buildfile (which runs the necessary commands for you). this allows us to use fewer keystrokes (which are expensive). When i’m using gradle to build the project, the jvm crashes on native platform file events.dll. i see there were several similar issues, but none of them can solve my problem. command line: add opens=java.base java.util=all unnamed a.

Понравилась статья? Поделить с друзьями:
0 0 голоса
Рейтинг статьи
Подписаться
Уведомить о
guest

0 комментариев
Старые
Новые Популярные
Межтекстовые Отзывы
Посмотреть все комментарии
  • Программа для восстановления windows 10 после вируса
  • Сброс компьютера до заводских настроек windows 10 ошибка
  • Альтернатива windows server 2019
  • Как поменять имя аккаунта в windows
  • Windows data sources odbc