简体   繁体   中英

Android studio gradle upgrade fails (http://schemas.android.com/apk/res/android URI not registered)

I have a complicated multi-project Android build. Recently upgraded to Android Studio 3.0.1 successfully. But attempting a corresponding upgrade to Android Plugin for Gradle 3.0.1 (And gradle version 4.1) breaks my project build.

There are a cascade of failure messages, but the primary ones seems to be that the http://schemas.android.com/apk/res/android is not a registered URI.

The project consists of a main project and three included subprojects. I did find a section reporting known problems with multi project builds in the Andriod Gradle Plugin upgrade documentation, but none of their recomendations resolved the issue.

Any help or advice would be much appreciated

Top level config files

build.gradle

buildscript {
    repositories {
        jcenter()
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

ext {
    versionName = '1.9.15-26'
    versionCode = 10915260
}

settings.gradle

include ':cadpage', ':cadpage-parsers', ':cadpage-private'

Cadpage subproject / build.gradle

apply plugin: 'com.android.application'

allprojects {
    repositories {
        jcenter()
        maven {
            url "https://maven.google.com"
        }
    }
}
android {
    compileSdkVersion 23
    buildToolsVersion '25.0.0'

    defaultConfig {
        applicationId 'net.anei.cadpage'
        versionName project.versionName
        versionCode project.versionCode
        minSdkVersion 9
        targetSdkVersion 23
    }

    dexOptions {
        jumboMode = true
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt')
        }
    }
}

dependencies {
    compile project(":cadpage-parsers")
    compile 'com.android.support:support-v4:23.0.1'
    compile 'com.google.android.gms:play-services-gcm:10.0.1'
}

cadpage-parsers subproject / build.gradle

apply plugin: 'java'

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
}

sourceCompatibility = '1.7'
targetCompatibility = '1.7'

jar {
    manifest {
        attributes('Implementation-Title': 'Cadpage Parsing Library',
                   'Implementation-Version': project.versionName,
                   'Main-Class' : 'net.anei.cadpage.parsers.Parser')
    }
}

As it turns out, the actual problem was a misplaced item in my AndroidManifest.xml file. This is a documented issue with the upgrade. What threw me off was the IDE reporting extraneous errors about the " http://schemas.android.com/apk/res/android " URI not being registered.

While the gradle console log did, in fact, identify the correct error. The IDE popped up the intermediate manifest file where the error occured. And syntax highlighting in that file started by complaining about the unregistered URI. I had been focusing on resolving what turned out to be a spurious error report.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM