: checkDebugManifest FAILED => the file specified for the 'manifest' property does not exist

Using this tutorial I want to build an existing project in Eclipse using Gradle.

build.grale contains:

buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.14.0' } } apply plugin: 'android' android { buildToolsVersion "19.1.0" compileSdkVersion 16 } repositories { mavenCentral() } dependencies { compile files('libs/android-support-v4.jar') } 

But I understand: enter image description here

How to solve this problem? I tried different approaches several times, but nothing worked.

+6
source share
2 answers

The default project structure has changed, so if you don’t tell the Gradle plugin where to find your manifest (and the rest of your code) or switch to the new structure, the Gradle plugin will look wrong place.

In your case, it looks for the manifest in \src\main\AndroidManifest.xml , which is used by default for new Gradle projects. The old project structure (used by Eclipse + ADT) places the manifest at the root of your project in \AndroidManifest.xml .

You can specify an alternate location in your build.gradle using closing sourceSets , for example:

 android { // ... sourceSets { main { manifest.srcFile 'AndroidManifest.xml' java.srcDirs = ['src'] resources.srcDirs = ['src'] aidl.srcDirs = ['src'] renderscript.srcDirs = ['src'] res.srcDirs = ['res'] assets.srcDirs = ['assets'] } debug.setRoot('build-types/debug') release.setRoot('build-types/release') } 

This will allow you to configure the Android Gradle plugin to use the old project structure for your manifest, Java sources, and resources.

If you are using the Android Studio import tool, it should take care of all this for you.

+8
source

This tutorial has nothing to do with creating an existing Eclipse project using Gradle. The word "Eclipse" is not displayed anywhere in the manual.

If you are trying to switch to Android Studio, use the import wizard of the Android Studio project.

If you are trying to use Eclipse but can also create Gradle assemblies, you can run the Eclipse Export Wizard to create the build.gradle file, although this will require additional configuration, as this wizard has not been updated in age.

Or, start with this build.gradle file and configure it accordingly:

 buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:1.0.0' } } apply plugin: 'com.android.application' dependencies { compile 'com.android.support:support-v4:21.0.0' } android { compileSdkVersion 19 buildToolsVersion "20.0.0" sourceSets { main { manifest.srcFile 'AndroidManifest.xml' java.srcDirs = ['src'] resources.srcDirs = ['src'] aidl.srcDirs = ['src'] renderscript.srcDirs = ['src'] res.srcDirs = ['res'] assets.srcDirs = ['assets'] } // Move the tests to tests/java, tests/res, etc... instrumentTest.setRoot('tests') // Move the build types to build-types/<type> // For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ... // This moves them out of them default location under src/<type>/... which would // conflict with src/ being used by the main source set. // Adding new build types or product flavors should be accompanied // by a similar customization. debug.setRoot('build-types/debug') release.setRoot('build-types/release') } } 
+1
source

Source: https://habr.com/ru/post/979414/


All Articles