Error: Unfortunately you can't have non-Gradle Java modules and > Android-Gradle modules in one project

Error: Unfortunately you can't have non-Gradle Java modules and > Android-Gradle modules in one project

Krystle Müjgan Author: Krystle Müjgan Date: 2022-08-14
Error: Unfortunately you can't have non-Gradle Java modules and > Android-Gradle modules in one project

All you need to know about Error: Unfortunately you can't have non-Gradle Java modules and > Android-Gradle modules in one project , in addintion to Android Studio - Unsupported Modules Detected - Unfortunately you can't have non-Gradle Java modules and Android-Gradle modules in one project , android - Caused by: java.lang.AssertionError: Could not delete caches dir yourProjectuildkotlincompileDebugTestingKotlin , android - Constraint layout Issue java.lang.AssertionError: TOP , android - Error: java.lang.UnsupportedOperationException: Can't convert to dimension: type=0x3

  1. Error: Unfortunately you can't have non-Gradle Java modules and > Android-Gradle modules in one project
  2. Question:

    I have an IntelliJ 14.1.2 Project consisting of two modules - one is an Android Gradle based module and the other is a Spring Java-based module with Maven.

    gps-trackman.v1 is my root project and I've not configured any outputs or facets for this project. The app is my android gradle module and I've configured Android and Android-Gradle Facet for this project and gps-trackman isn't my Spring Maven Project. I want to be able to build everything all together. Is it possible?

    I now get this error message in my IntelliJ Eventlog

    Unsupported Modules Detected: Compilation is not supported for following modules: gps-trackman, gps-trackman.v1, app. Unfortunately you can't have non-Gradle Java modules and Android-Gradle modules in one project.

    The project 'gps-trackman.v1' is not a Gradle-based

    Is this error just due to a misconfiguration of my project or is it really not possible to have a maven module and a Gradle module in one project?

    Do I have to configure any Facets for the root project? Alternatively, do I have to convert my maven to gradle?


    Solution 1:

    1- close the project

    2- close Android Studio IDE

    3- delete the .idea directory

    4- delete all .iml files

    5- open Android Studio IDE and import the project

    Answer from here

    Solution 2:

    1. Go to File -> Invalidate Caches/Restart.
    2. Close the project.
    3. Go to project folder and delete .idea folder.
    4. Delete YourProjectName.iml in project folder.
    5. Delete app.iml in app folder.
    6. Open Android studio -> open existing project, and then select your project.
    7. The Load Settings error and Unsupported modules detected error will be gone.

    Solution 3:

    1. Close the project
    2. Just delete the modules.xml in .idea folder.
    3. Open the project again.

  3. Android Studio - Unsupported Modules Detected - Unfortunately you can't have non-Gradle Java modules and Android-Gradle modules in one project
  4. Question:

    Related to Error: Unfortunately you can't have non-Gradle Java modules and > Android-Gradle modules in one project

    I upgraded gradle from version 3.5.3 to 3.6.2 today in my Android Java project, and now I get this error:

    Unsupported Modules Detected
    
    Compilation is not supported for following modules: NameOfMyApp, app. Unfortunately you can't have non-Gradle Java modules and Android-Gradle modules in one project.
    

    Unfortunately, I tried every solution in the linked question, but nothing worked. I still get this error. It seems like my project compiles and works just fine though. However, this error is annoying... continually popping up.

    Anyone know how to fix it? I only started having this issue since the upgrade of Android Studio, gradle, and other updates recently pushed out.


    Solution 1:

    Follow these steps one by one to solve the error.

    1. Close the Project
    2. Exit Android Studio
    3. Then go to your application folder and delete .iml file
    4. And also delete .idea Folder
    5. Then open Android studio again and import your project

    Note- If .iml and .idea files are not visible then press Command, shift and > buttons together when you are inside your Application folder

  5. android - Caused by: java.lang.AssertionError: Could not delete caches dir yourProjectuildkotlincompileDebugTestingKotlin
  6. Question:

    Sometimes this unexpected message appear and the only way to deal with this is to restart the pc and when it starts again go to the obove path and delete the file before start Android Studio with the project. It works for some time but latter appears again. Maybe someone of you know how deal better with this annoying issue.

    CreateProcess error=206, El nombre del archivo o la extensión es demasiado largo
    Caused by: java.lang.AssertionError: Could not delete caches dir YourProjectPath\build\kotlin\compileDebugTestingKotlin
    


    Solution 1:

    In windows open task manager.

    • Go to details tab.
    • Look for Java.exe.
    • End Task for all instances of Java.exe.

    This works perfectly for me.

    Solution 2:

    Solution 3:

    In windows open task manager CTRL + ALT + DEL
    You can see java.exe on the details page. End Task for all instances of Java.exe

    enter image description here

  7. android - Constraint layout Issue java.lang.AssertionError: TOP
  8. Question:

    I started using Constraint Layout, I facing Assertion Error while compiling the design file alone this issue will occur. What is the right way to fix this issue? I mess up with hole day. Here is my XML design.

    <?xml version="1.0" encoding="utf-8"?>
    <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        xmlns:tools="http://schemas.android.com/tools"
        android:id="@+id/cL_Layout"
        android:layout_width="match_parent"
        android:layout_height="80dp"
        android:background="@color/card_background">
    
        <android.support.constraint.Guideline
            android:id="@+id/gL_right_margin"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            app:layout_constraintGuide_percent="0.95" />
    
        <android.support.constraint.Guideline
            android:id="@+id/gL_vertical_center"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            app:layout_constraintGuide_percent="0.50364965" />
        <android.support.constraint.Guideline
            android:id="@+id/gL_bottom_margin"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            app:layout_constraintGuide_percent="1.0" />
    
        <android.support.constraint.Guideline
            android:id="@+id/gL_image_size_margin"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            app:layout_constraintGuide_percent="0.3" />
    
    
        <ImageView
            android:id="@+id/imgVw_AddClips_recVw_icon"
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:layout_marginBottom="4dp"
            android:layout_marginStart="4dp"
            android:layout_marginTop="4dp"
            android:adjustViewBounds="true"
            android:background="@drawable/qik_highlights_shape"
            android:contentDescription="@string/dummy_content"
            android:scaleType="fitCenter"
            android:src="@drawable/bg_cloud_icon"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toStartOf="@+id/gL_image_size_margin"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent" />
    
    
        <com.ibot.cyranoapp.customview.TextViewFont
            android:id="@+id/txtIp_recVw_AddClips_Name_title"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_alignParentStart="true"
            android:layout_marginStart="8dp"
            android:layout_marginTop="8dp"
            android:text="@string/recVw_Template_channel"
            android:textAllCaps="false"
            android:textColor="@color/fa_preview_button_text_grey"
            android:textSize="14sp"
            android:textStyle="bold"
            app:layout_constraintStart_toEndOf="@+id/gL_image_size_margin"
            app:layout_constraintTop_toTopOf="parent" />
    
    
        <com.ibot.cyranoapp.customview.TextViewFont
            android:id="@+id/txtIp_recVw_Components_Name_title"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_alignParentStart="true"
            android:layout_marginStart="8dp"
            android:text="@string/recVw_Template_Components"
            android:textAllCaps="false"
            android:textColor="@color/fa_preview_button_text_grey"
            android:textSize="12sp"
            app:layout_constraintStart_toEndOf="@+id/gL_image_size_margin"
            app:layout_constraintTop_toBottomOf="@+id/txtIp_recVw_AddClips_Name_title" />
    
        <com.ibot.cyranoapp.customview.TextViewFont
            android:id="@+id/txtIp_recVw_channel_subscribers_hint"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginStart="8dp"
            android:text="@string/channel_subscribers"
            android:textAllCaps="false"
            android:textColor="@color/fa_preview_button_text_grey"
            android:textSize="12sp"
            app:layout_constraintStart_toEndOf="@+id/gL_image_size_margin"
            app:layout_constraintTop_toBottomOf="@+id/txtIp_recVw_Components_Name_title" />
    
    
        <RadioButton
            android:id="@+id/rBtn_AddClips_SelectionIcon"
            android:layout_width="20dp"
            android:layout_height="20dp"
            android:layout_marginBottom="8dp"
            android:layout_marginTop="8dp"
            android:button="@drawable/qik_checkbox"
            android:text="@null"
            android:theme="@null"
            app:layout_constraintBottom_toTopOf="@+id/gL_bottom_margin"
            app:layout_constraintEnd_toStartOf="@+id/gL_right_margin"
            app:layout_constraintTop_toTopOf="parent" />
    
        <View
            android:id="@+id/view_template_1"
            android:layout_width="match_parent"
            android:layout_height="1dp"
            android:background="@color/fa_preview_button_text_grey"
            android:visibility="gone"
            app:layout_constraintBottom_toTopOf="@+id/gL_right_margin"
            app:layout_constraintEnd_toEndOf="@+id/gL_right_margin" />
    
        <View
            android:id="@+id/view_template_selection"
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:background="@color/fa_green_1"
            app:layout_constraintBottom_toBottomOf="@+id/view_template_1"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent" />
    </android.support.constraint.ConstraintLayout>
    

    And My Error Log here:

    java.lang.AssertionError: TOP at android.support.constraint.solver.widgets.Guideline.getAnchor(Guideline.java:159) at android.support.constraint.solver.widgets.ConstraintWidget.immediateConnect(ConstraintWidget.java:1597) at android.support.constraint.ConstraintLayout.setChildrenConstraints(ConstraintLayout.java:1031) at android.support.constraint.ConstraintLayout.updateHierarchy(ConstraintLayout.java:794) at android.support.constraint.ConstraintLayout.onMeasure(ConstraintLayout.java:1542) at android.view.View.measure(View.java:21051) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6459) at android.widget.FrameLayout.onMeasure(FrameLayout.java:185) at android.support.v7.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:141) at android.view.View.measure(View.java:21051) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6459) at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1464) at android.widget.LinearLayout.measureVertical(LinearLayout.java:758) at android.widget.LinearLayout.onMeasure(LinearLayout.java:640) at android.view.View.measure(View.java:21051) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6459) at android.widget.FrameLayout.onMeasure(FrameLayout.java:185) at android.view.View.measure(View.java:21051) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6459) at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1464) at android.widget.LinearLayout.measureVertical(LinearLayout.java:758) at android.widget.LinearLayout.onMeasure(LinearLayout.java:640) at android.view.View.measure(View.java:21051) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6459) at android.widget.FrameLayout.onMeasure(FrameLayout.java:185) at com.android.internal.policy.DecorView.onMeasure(DecorView.java:849) at android.view.View.measure(View.java:21051) at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2583) at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1642) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1893) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1522) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7098) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:927) at android.view.Choreographer.doCallbacks(Choreographer.java:702) at android.view.Choreographer.doFrame(Choreographer.java:638) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:913) at android.os.Handler.handleCallback(Handler.java:751) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6682) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1520) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1410)


    Solution 1:

    When you use a vertical guideline, any view constrained to it should do it horizontally and same thing for horizontal guidelines.

    In your case, your are constraining view_template_1 vertically to a vertical guideline so change this :

    app:layout_constraintBottom_toTopOf="@+id/gL_right_margin"
    

    by a horizontal guideline

    Always check your layouts and make sure you add the proper constraint to a guideline.

    Solution 2:

    I was missing the android:orientation="horizontal" / android:orientation="vertical" tag from the GuideLine. Make sure you have added it correctly.

    Finally, it should look like this

    <androidx.constraintlayout.widget.Guideline
            android:id="@+id/gl_1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            app:layout_constraintBottom_toBottomOf="@id/cv_rank_status"
            app:layout_constraintGuide_percent="0.3"
            app:layout_constraintTop_toTopOf="@id/cv_rank_status" />
    

    Solution 3:

    Try to remove plus symbol from referencing your guidelines. For example here app:layout_constraintEnd_toStartOf="@+id/gL_image_size_margin"

  9. android - Error: java.lang.UnsupportedOperationException: Can't convert to dimension: type=0x3
  10. Question:

    I'm making a simply app for android. But if I want to run my app I get a error:

    08-15 09:39:33.050: E/AndroidRuntime(871): FATAL EXCEPTION: main
    08-15 09:39:33.050: E/AndroidRuntime(871): Process: com.a3gaatleren, PID: 871
    08-15 09:39:33.050: E/AndroidRuntime(871): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.a3gaatleren/com.a3gaatleren.MainActivity}: java.lang.UnsupportedOperationException: Can't convert to dimension: type=0x3
    08-15 09:39:33.050: E/AndroidRuntime(871):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2184)
    08-15 09:39:33.050: E/AndroidRuntime(871):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233)
    08-15 09:39:33.050: E/AndroidRuntime(871):  at android.app.ActivityThread.access$800(ActivityThread.java:135)
    08-15 09:39:33.050: E/AndroidRuntime(871):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
    08-15 09:39:33.050: E/AndroidRuntime(871):  at android.os.Handler.dispatchMessage(Handler.java:102)
    08-15 09:39:33.050: E/AndroidRuntime(871):  at android.os.Looper.loop(Looper.java:136)
    08-15 09:39:33.050: E/AndroidRuntime(871):  at android.app.ActivityThread.main(ActivityThread.java:5001)
    08-15 09:39:33.050: E/AndroidRuntime(871):  at java.lang.reflect.Method.invokeNative(Native Method)
    08-15 09:39:33.050: E/AndroidRuntime(871):  at java.lang.reflect.Method.invoke(Method.java:515)
    08-15 09:39:33.050: E/AndroidRuntime(871):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
    08-15 09:39:33.050: E/AndroidRuntime(871):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
    08-15 09:39:33.050: E/AndroidRuntime(871):  at dalvik.system.NativeStart.main(Native Method)
    08-15 09:39:33.050: E/AndroidRuntime(871): Caused by: java.lang.UnsupportedOperationException: Can't convert to dimension: type=0x3
    08-15 09:39:33.050: E/AndroidRuntime(871):  at android.content.res.TypedArray.getDimensionPixelSize(TypedArray.java:464)
    08-15 09:39:33.050: E/AndroidRuntime(871):  at android.view.ViewGroup$MarginLayoutParams.<init>(ViewGroup.java:6129)
    08-15 09:39:33.050: E/AndroidRuntime(871):  at android.widget.FrameLayout$LayoutParams.<init>(FrameLayout.java:615)
    08-15 09:39:33.050: E/AndroidRuntime(871):  at android.widget.FrameLayout.generateLayoutParams(FrameLayout.java:559)
    08-15 09:39:33.050: E/AndroidRuntime(871):  at android.widget.FrameLayout.generateLayoutParams(FrameLayout.java:56)
    08-15 09:39:33.050: E/AndroidRuntime(871):  at android.view.LayoutInflater.inflate(LayoutInflater.java:480)
    08-15 09:39:33.050: E/AndroidRuntime(871):  at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
    08-15 09:39:33.050: E/AndroidRuntime(871):  at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
    08-15 09:39:33.050: E/AndroidRuntime(871):  at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:249)
    08-15 09:39:33.050: E/AndroidRuntime(871):  at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:106)
    08-15 09:39:33.050: E/AndroidRuntime(871):  at com.a3gaatleren.MainActivity.onCreate(MainActivity.java:17)
    08-15 09:39:33.050: E/AndroidRuntime(871):  at android.app.Activity.performCreate(Activity.java:5231)
    08-15 09:39:33.050: E/AndroidRuntime(871):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
    08-15 09:39:33.050: E/AndroidRuntime(871):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2148)
    08-15 09:39:33.050: E/AndroidRuntime(871):  ... 11 more
    08-15 09:39:38.860: I/Process(871): Sending signal. PID: 871 SIG: 9
    

    Mainactivity:

    package com.a3gaatleren;
    
    import android.support.v7.app.ActionBarActivity;
    import android.content.Intent;
    import android.os.Bundle;
    import android.view.Menu;
    import android.view.MenuItem;
    import android.view.View;
    import android.webkit.WebView;
    import android.widget.Button;
    
    public class MainActivity extends ActionBarActivity {
    
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main);
    
        final Button button = (Button) findViewById(R.id.button1);
        button.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
            startActivity(new Intent(MainActivity.this, Samenvattingen.class));
    
            }
        }
        );
    
        }
    
        @Override
        public boolean onCreateOptionsMenu(Menu menu) {
            // Inflate the menu; this adds items to the action bar if it is present.
            getMenuInflater().inflate(R.menu.main, menu);
            return true;
        }
    
        @Override
        public boolean onOptionsItemSelected(MenuItem item) {
            // Handle action bar item clicks here. The action bar will
            // automatically handle clicks on the Home/Up button, so long
            // as you specify a parent activity in AndroidManifest.xml.
            int id = item.getItemId();
            if (id == R.id.action_settings) {
                Intent menuIntent = new Intent(this, Instellingen.class);
                startActivity(menuIntent);
    
                return true;
            }
            return super.onOptionsItemSelected(item);
    
    
        }
    
    
    }
    

    activity_main.xml

    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_marginLeft="@string/marginbutton"
        android:layout_marginRight="@string/marginbutton"
        tools:context="com.a3gaatleren.MainActivity" >
    
        <Button
        android:id="@+id/button1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:layout_marginTop="82dp"
        android:text="@string/Samenvatting" />
    
        <Button
        android:id="@+id/button2"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_below="@+id/button1"
        android:text="@string/Woordenlijst" />
    
        <Button
        android:id="@+id/button3"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_below="@+id/button2"
        android:text="@string/Agenda" />
    
        <Button
        android:id="@+id/button4"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_below="@+id/button3"
        android:text="@string/Instellingen" />
    
    </RelativeLayout>
    

    Can someone tell me how to solve this problem?

    PS: English is not my first language, so I don't now of the English is correct


    Solution 1:

    You need to define your dimensional resources as dimens not strings. So, move your @string/marginbutton from strings.xml to res/values/dimens.xml as

    <?xml version="1.0" encoding="utf-8"?>
    <resources>
        <dimen
            name="marginbutton">8dp</dimen>
    </resources>
    

    Your error basically complains about passing a <string> resource where a <dimen> is expected.

    Solution 2:

    In my case it was mismatch about dimen and String too.

    But my error i put the background value in elevation to hold the ctrl+c value and forget there..

    may help somebody