Error while integrating OpenCV in Android Studio (color.xml, content not allowed in prolog) ...

How can I make names more distinctive without making them longer?

Is it ethical to give a final exam after the professor has quit before teaching the remaining chapters of the course?

How to do this path/lattice with tikz

How to deal with a team lead who never gives me credit?

Why is there no army of Iron-Mans in the MCU?

Why is black pepper both grey and black?

Is there any avatar supposed to be born between the death of Krishna and the birth of Kalki?

Why is "Consequences inflicted." not a sentence?

How to bypass password on Windows XP account?

Does surprise arrest existing movement?

Do you forfeit tax refunds/credits if you aren't required to and don't file by April 15?

Is there a "higher Segal conjecture"?

If a contract sometimes uses the wrong name, is it still valid?

Output the ŋarâþ crîþ alphabet song without using (m)any letters

Determinant is linear as a function of each of the rows of the matrix.

What is this single-engine low-wing propeller plane?

Did Xerox really develop the first LAN?

Are my PIs rude or am I just being too sensitive?

Gastric acid as a weapon

ListPlot join points by nearest neighbor rather than order

What are the motives behind Cersei's orders given to Bronn?

Letter Boxed validator

What do you call a phrase that's not an idiom yet?

How can players work together to take actions that are otherwise impossible?



Error while integrating OpenCV in Android Studio (color.xml, content not allowed in prolog)



Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)when i am using android studio getting this error “The environment variable JAVA_HOME does not point to valid jvm installation”Android Studio 3.2.1 Gradle Build Fail (colors.xml: “Content is not allowed in prolog”)Android Studio Lock File ErrorAndroid Studio colors.xmlChange default Android Studio Layout themeException when starting Android StudioRunning Android Studio emulator on Ryzen?Android Studio issueAndroid Studio - No system image is allowed to choose fromError grdle sync on Android Studio





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







0















I have been trying to integrate/use OpenCV in Android Studio. But I keep getting stuck with this error.



C:AndroidStudioProjectsIntegrateOpenCV341appsrcmainresvaluescolors.xml:1:1: Error: Content is not allowed in prolog.


I have tried to use:





  • OpenCV-2.4.9-Android-SDK




    reason: Most tutorials (outdated) work with this version





  • OpenCV-3.4.1-Android-SDK




    reason: Version with the latest tutorial (August 2018)





  • OpenCV-3.4.6-Android-SDK




    reason: Second latest version of OpenCV sdk android





  • OpenCV-4.1.0-Android-SDK




    reason: Latest version of OpenCV sdk android as of now





I went through these steps without error:




  1. Import Module (in a project)

  2. Add Dependency

  3. Edit compileSdkversion and targetSdkversion of OpenCV's build.gradle to match with app's build.gradle

  4. Made a Native folder (JNI folder) named jniLibs and copied the files inside sdk>native>libs to it


  5. Typed in this code in MainActivity.java to check if it works*



    package com.example.integrateopencv249; //also tried with 3.4.1 and 4.1.0

    import android.support.v7.app.AppCompatActivity;
    import android.os.Bundle;
    import android.widget.Toast;

    import org.opencv.android.OpenCVLoader;

    public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    if(OpenCVLoader.initDebug()) {
    Toast.makeText(getApplicationContext(), "OpenCV successfully loaded", Toast.LENGTH_SHORT).show();
    }
    else{
    Toast.makeText(getApplicationContext(), "OpenCV failed to load", Toast.LENGTH_SHORT).show();
    }
    }
    }



But after I run the last step. It just fails.



This is what is inside the color.xml (it is the same with all versions of OpenCV sdk)



package org.opencv.core;

import java.util.Arrays;import java.util.List;


public class MatOfRect extends Mat {// 32SC4private static final int _depth = CvType.CV_32S;private static final int


These are the details of my Android Studio:



Android Studio 3.3.2
Build #AI-182.5107.16.33.5314842, built on February 16, 2019
JRE: 1.8.0_152-release-1248-b01 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 10 10.0
(All of the SDK Tools are installed)


I tried to search for solutions to this problem but none are helpful to my situation.
Please help me :( I'm a complete beginner and I really want to start learning how to use OpenCV in Android Studio. I'd appreciate any help or suggestions.



note: I didn't continue OpenCV 4.1.0 after the first step because the module name only shows "java" and doesn't automatically update to the format "openCVLibrary410" as all the other versions before it do.










share|improve this question









New contributor




Kylie is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.



























    0















    I have been trying to integrate/use OpenCV in Android Studio. But I keep getting stuck with this error.



    C:AndroidStudioProjectsIntegrateOpenCV341appsrcmainresvaluescolors.xml:1:1: Error: Content is not allowed in prolog.


    I have tried to use:





    • OpenCV-2.4.9-Android-SDK




      reason: Most tutorials (outdated) work with this version





    • OpenCV-3.4.1-Android-SDK




      reason: Version with the latest tutorial (August 2018)





    • OpenCV-3.4.6-Android-SDK




      reason: Second latest version of OpenCV sdk android





    • OpenCV-4.1.0-Android-SDK




      reason: Latest version of OpenCV sdk android as of now





    I went through these steps without error:




    1. Import Module (in a project)

    2. Add Dependency

    3. Edit compileSdkversion and targetSdkversion of OpenCV's build.gradle to match with app's build.gradle

    4. Made a Native folder (JNI folder) named jniLibs and copied the files inside sdk>native>libs to it


    5. Typed in this code in MainActivity.java to check if it works*



      package com.example.integrateopencv249; //also tried with 3.4.1 and 4.1.0

      import android.support.v7.app.AppCompatActivity;
      import android.os.Bundle;
      import android.widget.Toast;

      import org.opencv.android.OpenCVLoader;

      public class MainActivity extends AppCompatActivity {

      @Override
      protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);

      if(OpenCVLoader.initDebug()) {
      Toast.makeText(getApplicationContext(), "OpenCV successfully loaded", Toast.LENGTH_SHORT).show();
      }
      else{
      Toast.makeText(getApplicationContext(), "OpenCV failed to load", Toast.LENGTH_SHORT).show();
      }
      }
      }



    But after I run the last step. It just fails.



    This is what is inside the color.xml (it is the same with all versions of OpenCV sdk)



    package org.opencv.core;

    import java.util.Arrays;import java.util.List;


    public class MatOfRect extends Mat {// 32SC4private static final int _depth = CvType.CV_32S;private static final int


    These are the details of my Android Studio:



    Android Studio 3.3.2
    Build #AI-182.5107.16.33.5314842, built on February 16, 2019
    JRE: 1.8.0_152-release-1248-b01 amd64
    JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
    Windows 10 10.0
    (All of the SDK Tools are installed)


    I tried to search for solutions to this problem but none are helpful to my situation.
    Please help me :( I'm a complete beginner and I really want to start learning how to use OpenCV in Android Studio. I'd appreciate any help or suggestions.



    note: I didn't continue OpenCV 4.1.0 after the first step because the module name only shows "java" and doesn't automatically update to the format "openCVLibrary410" as all the other versions before it do.










    share|improve this question









    New contributor




    Kylie is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.























      0












      0








      0


      2






      I have been trying to integrate/use OpenCV in Android Studio. But I keep getting stuck with this error.



      C:AndroidStudioProjectsIntegrateOpenCV341appsrcmainresvaluescolors.xml:1:1: Error: Content is not allowed in prolog.


      I have tried to use:





      • OpenCV-2.4.9-Android-SDK




        reason: Most tutorials (outdated) work with this version





      • OpenCV-3.4.1-Android-SDK




        reason: Version with the latest tutorial (August 2018)





      • OpenCV-3.4.6-Android-SDK




        reason: Second latest version of OpenCV sdk android





      • OpenCV-4.1.0-Android-SDK




        reason: Latest version of OpenCV sdk android as of now





      I went through these steps without error:




      1. Import Module (in a project)

      2. Add Dependency

      3. Edit compileSdkversion and targetSdkversion of OpenCV's build.gradle to match with app's build.gradle

      4. Made a Native folder (JNI folder) named jniLibs and copied the files inside sdk>native>libs to it


      5. Typed in this code in MainActivity.java to check if it works*



        package com.example.integrateopencv249; //also tried with 3.4.1 and 4.1.0

        import android.support.v7.app.AppCompatActivity;
        import android.os.Bundle;
        import android.widget.Toast;

        import org.opencv.android.OpenCVLoader;

        public class MainActivity extends AppCompatActivity {

        @Override
        protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        if(OpenCVLoader.initDebug()) {
        Toast.makeText(getApplicationContext(), "OpenCV successfully loaded", Toast.LENGTH_SHORT).show();
        }
        else{
        Toast.makeText(getApplicationContext(), "OpenCV failed to load", Toast.LENGTH_SHORT).show();
        }
        }
        }



      But after I run the last step. It just fails.



      This is what is inside the color.xml (it is the same with all versions of OpenCV sdk)



      package org.opencv.core;

      import java.util.Arrays;import java.util.List;


      public class MatOfRect extends Mat {// 32SC4private static final int _depth = CvType.CV_32S;private static final int


      These are the details of my Android Studio:



      Android Studio 3.3.2
      Build #AI-182.5107.16.33.5314842, built on February 16, 2019
      JRE: 1.8.0_152-release-1248-b01 amd64
      JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
      Windows 10 10.0
      (All of the SDK Tools are installed)


      I tried to search for solutions to this problem but none are helpful to my situation.
      Please help me :( I'm a complete beginner and I really want to start learning how to use OpenCV in Android Studio. I'd appreciate any help or suggestions.



      note: I didn't continue OpenCV 4.1.0 after the first step because the module name only shows "java" and doesn't automatically update to the format "openCVLibrary410" as all the other versions before it do.










      share|improve this question









      New contributor




      Kylie is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.












      I have been trying to integrate/use OpenCV in Android Studio. But I keep getting stuck with this error.



      C:AndroidStudioProjectsIntegrateOpenCV341appsrcmainresvaluescolors.xml:1:1: Error: Content is not allowed in prolog.


      I have tried to use:





      • OpenCV-2.4.9-Android-SDK




        reason: Most tutorials (outdated) work with this version





      • OpenCV-3.4.1-Android-SDK




        reason: Version with the latest tutorial (August 2018)





      • OpenCV-3.4.6-Android-SDK




        reason: Second latest version of OpenCV sdk android





      • OpenCV-4.1.0-Android-SDK




        reason: Latest version of OpenCV sdk android as of now





      I went through these steps without error:




      1. Import Module (in a project)

      2. Add Dependency

      3. Edit compileSdkversion and targetSdkversion of OpenCV's build.gradle to match with app's build.gradle

      4. Made a Native folder (JNI folder) named jniLibs and copied the files inside sdk>native>libs to it


      5. Typed in this code in MainActivity.java to check if it works*



        package com.example.integrateopencv249; //also tried with 3.4.1 and 4.1.0

        import android.support.v7.app.AppCompatActivity;
        import android.os.Bundle;
        import android.widget.Toast;

        import org.opencv.android.OpenCVLoader;

        public class MainActivity extends AppCompatActivity {

        @Override
        protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        if(OpenCVLoader.initDebug()) {
        Toast.makeText(getApplicationContext(), "OpenCV successfully loaded", Toast.LENGTH_SHORT).show();
        }
        else{
        Toast.makeText(getApplicationContext(), "OpenCV failed to load", Toast.LENGTH_SHORT).show();
        }
        }
        }



      But after I run the last step. It just fails.



      This is what is inside the color.xml (it is the same with all versions of OpenCV sdk)



      package org.opencv.core;

      import java.util.Arrays;import java.util.List;


      public class MatOfRect extends Mat {// 32SC4private static final int _depth = CvType.CV_32S;private static final int


      These are the details of my Android Studio:



      Android Studio 3.3.2
      Build #AI-182.5107.16.33.5314842, built on February 16, 2019
      JRE: 1.8.0_152-release-1248-b01 amd64
      JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
      Windows 10 10.0
      (All of the SDK Tools are installed)


      I tried to search for solutions to this problem but none are helpful to my situation.
      Please help me :( I'm a complete beginner and I really want to start learning how to use OpenCV in Android Studio. I'd appreciate any help or suggestions.



      note: I didn't continue OpenCV 4.1.0 after the first step because the module name only shows "java" and doesn't automatically update to the format "openCVLibrary410" as all the other versions before it do.







      java android xml android-studio opencv






      share|improve this question









      New contributor




      Kylie is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      share|improve this question









      New contributor




      Kylie is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      share|improve this question




      share|improve this question








      edited 23 hours ago







      Kylie













      New contributor




      Kylie is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked yesterday









      KylieKylie

      12




      12




      New contributor




      Kylie is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      Kylie is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      Kylie is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






















          0






          active

          oldest

          votes












          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "3"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });






          Kylie is a new contributor. Be nice, and check out our Code of Conduct.










          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1425524%2ferror-while-integrating-opencv-in-android-studio-color-xml-content-not-allowed%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          Kylie is a new contributor. Be nice, and check out our Code of Conduct.










          draft saved

          draft discarded


















          Kylie is a new contributor. Be nice, and check out our Code of Conduct.













          Kylie is a new contributor. Be nice, and check out our Code of Conduct.












          Kylie is a new contributor. Be nice, and check out our Code of Conduct.
















          Thanks for contributing an answer to Super User!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1425524%2ferror-while-integrating-opencv-in-android-studio-color-xml-content-not-allowed%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Couldn't open a raw socket. Error: Permission denied (13) (nmap)Is it possible to run networking commands...

          VNC viewer RFB protocol error: bad desktop size 0x0I Cannot Type the Key 'd' (lowercase) in VNC Viewer...

          Why not use the yoke to control yaw, as well as pitch and roll? Announcing the arrival of...