• 10
name

A PHP Error was encountered

Severity: Notice

Message: Undefined index: userid

Filename: views/question.php

Line Number: 191

Backtrace:

File: /home/prodcxja/public_html/questions/application/views/question.php
Line: 191
Function: _error_handler

File: /home/prodcxja/public_html/questions/application/controllers/Questions.php
Line: 433
Function: view

File: /home/prodcxja/public_html/questions/index.php
Line: 315
Function: require_once

The title is a duplicate but my question is different.

The same project works fine and is allowed to be built on

buildToolsVersion 23.0.3

on my colleague's system. As far as I know only the android studio version is different. Is it possible that if I hadn't upgraded my android studio to "2.3.Beta 2" I could still build with 23.0.3?

You have to change top-level build.gradle from

// Top-level build file where you can add configuration options common to all sub-projects/modules.

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

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
//        classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

to:

// Top-level build file where you can add configuration options common to all sub-projects/modules.

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

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
//        classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
    }
}

allprojects {
    repositories {
        jcenter()
    }
}
  • 97
Reply Report
    • Setting com.android.tools.build:gradle:2.2.3 also solved my problem when trying to compile react-native-mail ?
      • 2
    • 2.3.0 is a new gradle plugin and it is supposed to work with buildToolsVersion 25 or higher. If you change gradle plugin version to 2.2.3 you get possibility to work with old buildToolsVersion 23.0.3.

Ok I found a solution to this.

For people facing the same problem in the future, here's what I did:

I added the following to my root build gradle android/build.gradle (Not the android/app/build.gradle)

subprojects {
    afterEvaluate {project ->
        if (project.hasProperty("android")) {
            android {
                compileSdkVersion 25
                buildToolsVersion '25.0.0'
            }
        }
    }
}

That forces all the submodules to use the specified compileSdkVersion and buildToolsVersion. Problem gone now.

  • 5
Reply Report

if I hadn't upgraded my android studio to "2.3.Beta 2" I could still build with 23.0.3?

Yes.

You can still run the build process from command line with any version of build tools.

Feel free to upgrade build tools to 25.0.2 (latest as of 27.1.2017). This only affects build process, it doesn't affect the app behavior.

Newer versions of build tools incorporate more options and newer technologies and newer versions of Android Studio depend on these technologies.

  • 3
Reply Report
    • Building with 25 gives me an error /* java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity. */ With 23 none of my colleagues are getting that error. Same project,same code. That's the reason Im confused
      • 1
    • That's after building and running so unrelated to original question. Do what it says! Thats one of the most helpful messages!
    • Change back com.android.tools.build:gradle:2.3.0 to com.android.tools.build:gradle:2.2.3 in the top-level build.gradle.
    • I am trying to run with 23.0.3 but it keeps showing the above mentioned error and refuses to compile. I have all sdk versions downloaded till date. Why is the studio preventing me from running in 23? I am just trying to figure out whether it has anything to do with the studio update

I solved this issue:

added this code in android/build.gradle

```

subprojects {
    afterEvaluate {project ->
        if (project.hasProperty("android")) {
            android {
                compileSdkVersion 26
                buildToolsVersion '26.0.0'
            }
        }
    }
}

```

  • -1
Reply Report