Bug 1352015 - DO NOT LAND - Hack together a working build targeting Android O. f?sebastian draft
authorNick Alexander <nalexander@mozilla.com>
Fri, 31 Mar 2017 16:41:54 -0700
changeset 554570 05887acad6ef5339d5dc6fa5ca2462052573202e
parent 553344 4c7c05a49f3ce40aa0969beccb397380a8907f4a
child 555187 97ce03b719fd566bd17f259a57ff17db1d026ae2
push id51992
push usernalexander@mozilla.com
push dateFri, 31 Mar 2017 23:42:27 +0000
bugs1352015
milestone55.0a1
Bug 1352015 - DO NOT LAND - Hack together a working build targeting Android O. f?sebastian With these changes, I have an x86 artifact build installing, running, and rendering on the Android O x86 emulator image (identified as "system-images;android-O;google_apis;x86"). My intention with posting this is to merely show what I needed to do to get this working locally; I'll file follow-up tickets tracking the work needed to make this happen for real. No try builds yet 'cuz I don't feel like building tooltool packages right now. There are several areas of incompatibility that will need to be audited or manually tested to see if we're Android O compatible, but that's future work for other people. MozReview-Commit-ID: 6CjNHFd9OYT
build.gradle
build/annotationProcessors/moz.build
gradle/wrapper/gradle-wrapper.properties
mobile/android/app/build.gradle
mobile/android/app/src/androidTest/AndroidManifest.xml
mobile/android/base/AndroidManifest.xml.in
mobile/android/base/Makefile.in
mobile/android/base/java/org/mozilla/gecko/updater/UpdateService.java
mobile/android/bouncer/AndroidManifest.xml.in
mobile/android/bouncer/build.gradle
mobile/android/bouncer/java/org/mozilla/bouncer/BouncerService.java
mobile/android/geckoview/build.gradle
mobile/android/geckoview_example/build.gradle
mobile/android/search/java/org/mozilla/search/PostSearchFragment.java
mobile/android/stumbler/moz.build
mobile/android/tests/background/junit3/AndroidManifest.xml.in
mobile/android/tests/browser/junit3/AndroidManifest.xml.in
mobile/android/tests/browser/junit3/moz.build
mobile/android/tests/browser/robocop/AndroidManifest.xml.in
mobile/android/thirdparty/build.gradle
old-configure.in
widget/android/bindings/moz.build
--- a/build.gradle
+++ b/build.gradle
@@ -21,30 +21,29 @@ buildDir "${topobjdir}/gradle/build"
 
 buildscript {
     repositories {
         if (gradle.mozconfig.substs.GRADLE_MAVEN_REPOSITORY) {
             maven {
                 url gradle.mozconfig.substs.GRADLE_MAVEN_REPOSITORY
             }
         }
-        // For android-sdk-manager SNAPSHOT releases.
+        // For dexcount-gradle-plugin and other in tree plugins.
         maven {
             url "file://${gradle.mozconfig.topsrcdir}/mobile/android/gradle/m2repo"
         }
     }
 
     dependencies {
-        classpath 'com.android.tools.build:gradle:2.1.3'
+        classpath 'com.android.tools.build:gradle:2.4.0-alpha3'
         classpath('com.stanfy.spoon:spoon-gradle-plugin:1.0.4') {
             // Without these, we get errors linting.
             exclude module: 'guava'
         }
         // Provided in tree.
-        classpath 'com.jakewharton.sdkmanager:gradle-plugin:1.5.0-SNAPSHOT'
         classpath 'com.getkeepsafe.dexcount:dexcount-gradle-plugin:0.6.1'
     }
 }
 
 task generateCodeAndResources(type:Exec) {
     workingDir "${topobjdir}"
 
     commandLine mozconfig.substs.GMAKE
--- a/build/annotationProcessors/moz.build
+++ b/build/annotationProcessors/moz.build
@@ -14,11 +14,12 @@ jar.sources += [
     'classloader/JarClassIterator.java',
     'CodeGenerator.java',
     'SDKProcessor.java',
     'utils/AlphabeticAnnotatableEntityComparator.java',
     'utils/GeneratableElementIterator.java',
     'utils/Utils.java',
 ]
 jar.extra_jars += [
-    CONFIG['ANDROID_TOOLS'] + '/lib/lint.jar',
-    CONFIG['ANDROID_TOOLS'] + '/lib/lint-checks.jar',
+    CONFIG['ANDROID_TOOLS'] + '/lib/lint-25.3.1.jar',
+    CONFIG['ANDROID_TOOLS'] + '/lib/lint-api-25.3.1.jar',
+    CONFIG['ANDROID_TOOLS'] + '/lib/lint-checks-25.3.1.jar',
 ]
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,7 +1,7 @@
 #Fri Sep 16 15:41:50 PDT 2016
 distributionBase=GRADLE_USER_HOME
 distributionPath=wrapper/dists
 zipStoreBase=GRADLE_USER_HOME
 zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
-distributionSha256Sum=88a910cdf2e03ebbb5fe90f7ecf534fc9ac22e12112dc9a2fee810c598a76091
+distributionUrl=https\://services.gradle.org/distributions/gradle-3.4.1-all.zip
+distributionSha256Sum=ed7e9c8bb41bd10d4c9339c95b2f8b122f5bf13188bd90504a26e0f00b123b0d
--- a/mobile/android/app/build.gradle
+++ b/mobile/android/app/build.gradle
@@ -1,27 +1,26 @@
 buildDir "${topobjdir}/gradle/build/mobile/android/app"
 
-apply plugin: 'android-sdk-manager' // Must come before 'com.android.*'.
 apply plugin: 'com.android.application'
 apply plugin: 'checkstyle'
 apply plugin: 'com.getkeepsafe.dexcount'
 apply plugin: 'findbugs'
 
 dexcount {
     format = "tree"
 }
 
 android {
-    compileSdkVersion 23
+    compileSdkVersion 'android-O'
     buildToolsVersion mozconfig.substs.ANDROID_BUILD_TOOLS_VERSION
 
     defaultConfig {
-        targetSdkVersion 23
-        minSdkVersion 15
+        targetSdkVersion mozconfig.substs.ANDROID_TARGET_SDK
+        minSdkVersion mozconfig.substs.MOZ_ANDROID_MIN_SDK_VERSION
         applicationId mozconfig.substs.ANDROID_PACKAGE_NAME
         testApplicationId 'org.mozilla.roboexample.test'
         testInstrumentationRunner 'org.mozilla.gecko.FennecInstrumentationTestRunner'
         manifestPlaceholders = [
             ANDROID_PACKAGE_NAME: mozconfig.substs.ANDROID_PACKAGE_NAME,
             MOZ_ANDROID_MIN_SDK_VERSION: mozconfig.substs.MOZ_ANDROID_MIN_SDK_VERSION,
             MOZ_ANDROID_SHARED_ID: "${mozconfig.substs.ANDROID_PACKAGE_NAME}.sharedID",
         ]
@@ -442,9 +441,9 @@ android.applicationVariants.all { varian
             html.enabled = true // We only care about HTML reports for humans
             xml.enabled = false
 
             html.destination = "$project.buildDir/outputs/findbugs/findbugs-${variant.name}-output.html"
         }
 
         dependsOn "assemble${variant.name.capitalize()}"
     }
-}
\ No newline at end of file
+}
--- a/mobile/android/app/src/androidTest/AndroidManifest.xml
+++ b/mobile/android/app/src/androidTest/AndroidManifest.xml
@@ -1,17 +1,17 @@
 <?xml version="1.0" encoding="utf-8"?>
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
     package="org.mozilla.roboexample.test"
     android:sharedUserId="${MOZ_ANDROID_SHARED_ID}"
     android:versionCode="1"
     android:versionName="1.0" >
 
     <uses-sdk android:minSdkVersion="${MOZ_ANDROID_MIN_SDK_VERSION}"
-              android:targetSdkVersion="23"/>
+              android:targetSdkVersion="${ANDROID_TARGET_SDK}"/>
     <!-- TODO: re-instate maxSdkVersion. -->
 
     <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
 
     <uses-permission android:name="android.permission.DISABLE_KEYGUARD" />
     <uses-permission android:name="android.permission.WAKE_LOCK" />
 
     <instrumentation
--- a/mobile/android/base/AndroidManifest.xml.in
+++ b/mobile/android/base/AndroidManifest.xml.in
@@ -8,17 +8,17 @@
 #ifdef MOZ_ANDROID_SHARED_ID
       android:sharedUserId="@MOZ_ANDROID_SHARED_ID@"
 #endif
       >
     <uses-sdk android:minSdkVersion="@MOZ_ANDROID_MIN_SDK_VERSION@"
 #ifdef MOZ_ANDROID_MAX_SDK_VERSION
               android:maxSdkVersion="@MOZ_ANDROID_MAX_SDK_VERSION@"
 #endif
-              android:targetSdkVersion="23"/>
+              android:targetSdkVersion="@ANDROID_TARGET_SDK@"/>
 
 <!-- The bouncer APK and the main APK should define the same set of
      <permission>, <uses-permission>, and <uses-feature> elements.  This reduces
      the likelihood of permission-related surprises when installing the main APK
      on top of a pre-installed bouncer APK.  Add such shared elements in the
      fileincluded here, so that they can be referenced by both APKs. -->
 #include FennecManifest_permissions.xml.in
 
--- a/mobile/android/base/Makefile.in
+++ b/mobile/android/base/Makefile.in
@@ -266,48 +266,51 @@ classycle_jar := $(topsrcdir)/mobile/and
 .geckoview.deps: geckoview.ddf $(classycle_jar) $(ALL_JARS)
 	$(JAVA) -cp $(classycle_jar) \
 		classycle.dependency.DependencyChecker \
 		-mergeInnerClasses \
 		-dependencies=@$< \
 		$(ALL_JARS)
 	@$(TOUCH) $@
 
+# $(ANDROID_SDK_ROOT)/tools/proguard/lib/proguard.jar
+PROGUARD_JAR=/Users/nalexander/Downloads/proguard5.3.2/lib/proguard.jar
+
 # First, we delete debugging information from libraries. Having line-number
 # information for libraries for which we lack the source isn't useful, so this
 # saves us a bit of space. Importantly, Proguard has a bug causing it to
 # sometimes corrupt this information if present (which it does for some of the
 # included libraries). This corruption prevents dex from completing, so we need
 # to get rid of it.  This prevents us from seeing line numbers in stack traces
 # for stack frames inside libraries.
 #
 # This step can occur much earlier than the main Proguard pass: it needs only
 # gecko-R.jar to have been compiled (as that's where the library R.java files
 # end up), but it does block the main Proguard pass.
 .bundled.proguard.deps: gecko-R.jar $(proguard_config_dir)/strip-libs.cfg
 	$(REPORT_BUILD)
 	@$(TOUCH) $@
 	$(JAVA) \
 		-Xmx512m -Xms128m \
-		-jar $(ANDROID_SDK_ROOT)/tools/proguard/lib/proguard.jar \
+		-jar $(PROGUARD_JAR) \
 		@$(proguard_config_dir)/strip-libs.cfg \
 		-injars $(subst ::,:,$(java_bundled_libs))\
 		-outjars bundled-jars-nodebug \
 		-libraryjars $(library_jars):gecko-R.jar
 
 # We touch the target file before invoking Proguard so that Proguard's
 # outputs are fresher than the target, preventing a subsequent
 # invocation from thinking Proguard's outputs are stale.  This is safe
 # because Make removes the target file if any recipe command fails.
 .proguard.deps: .geckoview.deps .bundled.proguard.deps $(ALL_JARS) $(proguard_config_dir)/proguard.cfg
 	$(REPORT_BUILD)
 	@$(TOUCH) $@
 	$(JAVA) \
 		-Xmx512m -Xms128m \
-		-jar $(ANDROID_SDK_ROOT)/tools/proguard/lib/proguard.jar \
+		-jar $(PROGUARD_JAR) \
 		@$(proguard_config_dir)/proguard.cfg \
 		-optimizationpasses $(PROGUARD_PASSES) \
 		-injars $(subst ::,:,$(all_jars_classpath)):bundled-jars-nodebug \
 		-outjars jars-proguarded \
 		-libraryjars $(library_jars)
 
 ANNOTATION_PROCESSOR_JAR_FILES := $(DEPTH)/build/annotationProcessors/annotationProcessors.jar
 
--- a/mobile/android/base/java/org/mozilla/gecko/updater/UpdateService.java
+++ b/mobile/android/base/java/org/mozilla/gecko/updater/UpdateService.java
@@ -142,18 +142,18 @@ public class UpdateService extends Inten
     @Override
     public void onCreate () {
         mCrashHandler = CrashHandler.createDefaultCrashHandler(getApplicationContext());
 
         super.onCreate();
 
         mPrefs = getSharedPreferences(PREFS_NAME, 0);
         mNotificationManager = NotificationManagerCompat.from(this);
-        mConnectivityManager = (ConnectivityManager)getSystemService(Context.CONNECTIVITY_SERVICE);
-        mWifiLock = ((WifiManager)getSystemService(Context.WIFI_SERVICE))
+        mConnectivityManager = (ConnectivityManager) getApplicationContext().getSystemService(Context.CONNECTIVITY_SERVICE);
+        mWifiLock = ((WifiManager) getApplicationContext().getSystemService(Context.WIFI_SERVICE))
                     .createWifiLock(WifiManager.WIFI_MODE_FULL_HIGH_PERF, PREFS_NAME);
         mCancelDownload = false;
     }
 
     @Override
     public void onDestroy() {
         mCrashHandler.unregister();
         mCrashHandler = null;
--- a/mobile/android/bouncer/AndroidManifest.xml.in
+++ b/mobile/android/bouncer/AndroidManifest.xml.in
@@ -8,17 +8,17 @@
 #ifdef MOZ_ANDROID_SHARED_ID
       android:sharedUserId="@MOZ_ANDROID_SHARED_ID@"
 #endif
       >
     <uses-sdk android:minSdkVersion="@MOZ_ANDROID_MIN_SDK_VERSION@"
 #ifdef MOZ_ANDROID_MAX_SDK_VERSION
               android:maxSdkVersion="@MOZ_ANDROID_MAX_SDK_VERSION@"
 #endif
-              android:targetSdkVersion="23"/>
+              android:targetSdkVersion="${ANDROID_TARGET_SDK}"/>
 
 <!-- The bouncer APK and the main APK should define the same set of
      <permission>, <uses-permission>, and <uses-feature> elements.  This reduces
      the likelihood of permission-related surprises when installing the main APK
      on top of a pre-installed bouncer APK.  Add such shared elements in the
      fileincluded here, so that they can be referenced by both APKs. -->
 #include ../base/FennecManifest_permissions.xml.in
 
--- a/mobile/android/bouncer/build.gradle
+++ b/mobile/android/bouncer/build.gradle
@@ -1,19 +1,19 @@
 buildDir "${topobjdir}/gradle/build/mobile/android/bouncer"
 
 apply plugin: 'com.android.application'
 
 android {
-    compileSdkVersion 23
+    compileSdkVersion 'android-O'
     buildToolsVersion mozconfig.substs.ANDROID_BUILD_TOOLS_VERSION
 
     defaultConfig {
-        targetSdkVersion 23
-        minSdkVersion 15 
+        targetSdkVersion mozconfig.substs.ANDROID_TARGET_SDK
+        minSdkVersion 15
         applicationId mozconfig.substs.ANDROID_PACKAGE_NAME
     }
 
     compileOptions {
         sourceCompatibility JavaVersion.VERSION_1_7
         targetCompatibility JavaVersion.VERSION_1_7
     }
  
--- a/mobile/android/bouncer/java/org/mozilla/bouncer/BouncerService.java
+++ b/mobile/android/bouncer/java/org/mozilla/bouncer/BouncerService.java
@@ -90,22 +90,18 @@ public class BouncerService extends Inte
                 getFiles(path + "/" + file, acc);
             }
         } else {
             // We're a file -- accumulate.
             acc.add(path);
         }
     }
 
-    private String getDataDir() {
-        return getApplicationInfo().dataDir;
-    }
-
     private File getDataFile(final String path) {
-        File outFile = new File(getDataDir(), path);
+        File outFile = new File(getApplicationInfo().dataDir, path);
         File dir = outFile.getParentFile();
 
         if (dir != null && !dir.exists()) {
             Log.d(LOGTAG, "Creating " + dir.getAbsolutePath());
             if (!dir.mkdirs()) {
                 Log.e(LOGTAG, "Unable to create directories: " + dir.getAbsolutePath());
                 return null;
             }
--- a/mobile/android/geckoview/build.gradle
+++ b/mobile/android/geckoview/build.gradle
@@ -1,27 +1,26 @@
 buildDir "${topobjdir}/gradle/build/mobile/android/geckoview"
 
-apply plugin: 'android-sdk-manager' // Must come before 'com.android.*'.
 apply plugin: 'com.android.library'
 
 def VERSION_NAME = '0.0.1'
 
 android {
-    compileSdkVersion 23
+    compileSdkVersion 'android-O'
     buildToolsVersion mozconfig.substs.ANDROID_BUILD_TOOLS_VERSION
 
     defaultConfig {
         // TODO: version GeckoView explicitly.  We'd like to avoid
         // mozconfig.substs.ANDROID_VERSION_CODE, which won't be intuitive to
         // consumer (and advances very quickly on pre-release channels).
         versionCode 1
         versionName VERSION_NAME
-        targetSdkVersion 23
-        minSdkVersion 15
+        targetSdkVersion mozconfig.substs.ANDROID_TARGET_SDK
+        minSdkVersion mozconfig.substs.MOZ_ANDROID_MIN_SDK_VERSION
         consumerProguardFiles 'proguard-rules.txt'
 
         // TODO: ensure these fields always agree with mobile/android/geckoview/BuildConfig.java.in,
         // either by diffing the processed files or by generating the output from a single source.
         buildConfigField 'String', "GRE_MILESTONE", "\"${mozconfig.substs.GRE_MILESTONE}\""
         buildConfigField 'String', "MOZ_APP_ABI", "\"${mozconfig.substs.MOZ_APP_ABI}\"";
         buildConfigField 'String', "MOZ_APP_BASENAME", "\"${mozconfig.substs.MOZ_APP_BASENAME}\"";
 
--- a/mobile/android/geckoview_example/build.gradle
+++ b/mobile/android/geckoview_example/build.gradle
@@ -1,20 +1,20 @@
 buildDir "${topobjdir}/gradle/build/mobile/android/geckoview_example"
 
 apply plugin: 'com.android.application'
 
 android {
-    compileSdkVersion 23
+    compileSdkVersion 'android-O'
     buildToolsVersion mozconfig.substs.ANDROID_BUILD_TOOLS_VERSION
 
     defaultConfig {
         applicationId "org.mozilla.geckoview_example"
-        minSdkVersion 15
-        targetSdkVersion 23
+        minSdkVersion mozconfig.substs.MOZ_ANDROID_MIN_SDK_VERSION
+        targetSdkVersion mozconfig.substs.ANDROID_TARGET_SDK
         versionCode 1
         versionName "1.0"
         testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
     }
 
     // This is extremely frustrating, but the only way to do it automation for
     // now.  Without this, we only get a "debugAndroidTest" configuration; we
     // have no "withoutGeckoBinariesAndroidTest" configuration.
--- a/mobile/android/search/java/org/mozilla/search/PostSearchFragment.java
+++ b/mobile/android/search/java/org/mozilla/search/PostSearchFragment.java
@@ -105,16 +105,17 @@ public class PostSearchFragment extends 
         private boolean networkError;
 
         @Override
         public void onPageStarted(WebView view, final String url, Bitmap favicon) {
             // Reset the error state.
             networkError = false;
         }
 
+        @SuppressWarnings("deprecation")
         @Override
         public boolean shouldOverrideUrlLoading(WebView view, String url) {
             // Ignore about:blank URL loads and the first results page we try to load.
             if (TextUtils.equals(url, Constants.ABOUT_BLANK) || resultsPageHost == null) {
                 return false;
             }
 
             String host = null;
--- a/mobile/android/stumbler/moz.build
+++ b/mobile/android/stumbler/moz.build
@@ -4,9 +4,11 @@
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 include('stumbler_sources.mozbuild')
 
 stumbler_jar = add_java_jar('stumbler')
 stumbler_jar.sources += stumbler_sources
 stumbler_jar.extra_jars += [CONFIG['ANDROID_SUPPORT_V4_AAR_LIB']]
-stumbler_jar.javac_flags += ['-Xlint:all']
+# Android has deprecated most of the GPS interfaces stumbler uses, so
+# we need -deprecation.
+stumbler_jar.javac_flags += ['-Xlint:all,-deprecation']
--- a/mobile/android/tests/background/junit3/AndroidManifest.xml.in
+++ b/mobile/android/tests/background/junit3/AndroidManifest.xml.in
@@ -1,17 +1,17 @@
 #filter substitution
 <?xml version="1.0" encoding="utf-8"?>
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
     package="org.mozilla.gecko.background.tests"
     sharedUserId="@MOZ_ANDROID_SHARED_ID@"
     android:versionCode="1"
     android:versionName="1.0" >
 
-    <uses-sdk android:minSdkVersion="8"
+    <uses-sdk android:minSdkVersion="@MOZ_ANDROID_MIN_SDK_VERSION@"
               android:targetSdkVersion="@ANDROID_TARGET_SDK@" />
 
     <application
         android:debuggable="true"
         android:icon="@drawable/icon"
         android:label="@ANDROID_BACKGROUND_APP_DISPLAYNAME@">
         <uses-library android:name="android.test.runner" />
     </application>
--- a/mobile/android/tests/browser/junit3/AndroidManifest.xml.in
+++ b/mobile/android/tests/browser/junit3/AndroidManifest.xml.in
@@ -1,17 +1,17 @@
 #filter substitution
 <?xml version="1.0" encoding="utf-8"?>
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
     package="org.mozilla.gecko.browser.tests"
     sharedUserId="@MOZ_ANDROID_SHARED_ID@"
     android:versionCode="1"
     android:versionName="1.0" >
 
-    <uses-sdk android:minSdkVersion="8"
+    <uses-sdk android:minSdkVersion="@MOZ_ANDROID_MIN_SDK_VERSION@"
               android:targetSdkVersion="@ANDROID_TARGET_SDK@" />
 
     <application
         android:debuggable="true"
         android:icon="@drawable/icon"
         android:label="@ANDROID_BROWSER_APP_DISPLAYNAME@">
         <uses-library android:name="android.test.runner" />
     </application>
--- a/mobile/android/tests/browser/junit3/moz.build
+++ b/mobile/android/tests/browser/junit3/moz.build
@@ -19,17 +19,20 @@ jar.sources += [
     'src/org/mozilla/tests/browser/junit3/TestGeckoProfilesProvider.java',
     'src/org/mozilla/tests/browser/junit3/TestGeckoSharedPrefs.java',
     'src/org/mozilla/tests/browser/junit3/TestImageDownloader.java',
     'src/org/mozilla/tests/browser/junit3/TestJarReader.java',
     'src/org/mozilla/tests/browser/junit3/TestRawResource.java',
     'src/org/mozilla/tests/browser/junit3/TestSuggestedSites.java',
 ]
 jar.generated_sources = [] # None yet -- try to keep it this way.
-jar.javac_flags += ['-Xlint:all']
+# MockResources has been deprecated, so we need -deprecation.  See
+# https://github.com/Countly/countly-sdk-android/blob/ae89490a5646e7db09c855f62b35c861819300cd/sdk/src/androidTest/java/ly/count/android/sdk/DeviceInfoTests.java#L80
+# for a Mockito-based approach.
+jar.javac_flags += ['-Xlint:all,-deprecation']
 
 jar.extra_jars += [
     CONFIG['ANDROID_SUPPORT_V4_AAR_LIB'],
     CONFIG['ANDROID_RECYCLERVIEW_V7_AAR_LIB'],
     TOPOBJDIR + '/mobile/android/base/constants.jar',
     TOPOBJDIR + '/mobile/android/base/gecko-R.jar',
     TOPOBJDIR + '/mobile/android/base/gecko-browser.jar',
     TOPOBJDIR + '/mobile/android/base/gecko-mozglue.jar',
--- a/mobile/android/tests/browser/robocop/AndroidManifest.xml.in
+++ b/mobile/android/tests/browser/robocop/AndroidManifest.xml.in
@@ -7,17 +7,17 @@
 #endif
     android:versionCode="1"
     android:versionName="1.0" >
 
     <uses-sdk android:minSdkVersion="@MOZ_ANDROID_MIN_SDK_VERSION@"
 #ifdef MOZ_ANDROID_MAX_SDK_VERSION
               android:maxSdkVersion="@MOZ_ANDROID_MAX_SDK_VERSION@"
 #endif
-              android:targetSdkVersion="23"/>
+              android:targetSdkVersion="@ANDROID_TARGET_SDK@"/>
 
     <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
 
     <uses-permission android:name="android.permission.DISABLE_KEYGUARD" />
     <uses-permission android:name="android.permission.WAKE_LOCK" />
 
     <instrumentation
         android:name="org.mozilla.gecko.FennecInstrumentationTestRunner"
--- a/mobile/android/thirdparty/build.gradle
+++ b/mobile/android/thirdparty/build.gradle
@@ -1,19 +1,19 @@
 buildDir "${topobjdir}/gradle/build/mobile/android/thirdparty"
 
 apply plugin: 'com.android.library'
 
 android {
-    compileSdkVersion 23
+    compileSdkVersion 'android-O'
     buildToolsVersion mozconfig.substs.ANDROID_BUILD_TOOLS_VERSION
 
     defaultConfig {
-        targetSdkVersion 23
-        minSdkVersion 15
+        targetSdkVersion mozconfig.substs.ANDROID_TARGET_SDK
+        minSdkVersion mozconfig.substs.MOZ_ANDROID_MIN_SDK_VERSION
     }
 
     compileOptions {
         sourceCompatibility JavaVersion.VERSION_1_7
         targetCompatibility JavaVersion.VERSION_1_7
     }
 
     lintOptions {
--- a/old-configure.in
+++ b/old-configure.in
@@ -2339,17 +2339,17 @@ AC_SUBST(MOZ_B2G_VERSION)
 dnl ========================================================
 dnl Ensure Android SDK and build-tools versions depending on
 dnl mobile target.
 dnl ========================================================
 
 if test -z "$gonkdir" ; then
     case "$MOZ_BUILD_APP" in
     mobile/android)
-        MOZ_ANDROID_SDK(23, 23.0.3 23.0.1)
+        MOZ_ANDROID_SDK(O, 26.0.0-rc1)
         ;;
     esac
 fi
 
 dnl ========================================================
 dnl =
 dnl = Toolkit Options
 dnl =
--- a/widget/android/bindings/moz.build
+++ b/widget/android/bindings/moz.build
@@ -1,41 +1,42 @@
 # -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
-# List of stems to generate .cpp and .h files for.  To add a stem, add it to
-# this list and ensure that $(stem)-classes.txt exists in this directory.
-generated = [
-    'AndroidRect',
-    'Bundle',
-    'KeyEvent',
-    'MediaCodec',
-    'MotionEvent',
-    'SurfaceTexture',
-    'ViewConfiguration'
-]
-
-SOURCES += ['!%s.cpp' % stem for stem in generated]
-
-EXPORTS += ['!%s.h' % stem for stem in generated]
-
-# We'd like to add these to a future GENERATED_EXPORTS list, but for now we mark
-# them as generated here and manually install them in Makefile.in.
-GENERATED_FILES += [stem + '.h' for stem in generated]
-
-# There is an unfortunate race condition when using generated SOURCES and
-# pattern rules (see Makefile.in) that manifests itself as a VPATH resolution
-# conflict: MediaCodec.o looks for MediaCodec.cpp and $(CURDIR)/MediaCodec.cpp,
-# and the pattern rule is matched but doesn't resolve both sources, causing a
-# failure.  Adding the SOURCES to GENERATED_FILES causes the sources
-# to be built at export time, which is before MediaCodec.o needs them; and by
-# the time MediaCodec.o is built, the source is in place and the VPATH
-# resolution works as expected.
-GENERATED_FILES += [f[1:] for f in SOURCES]
-
-FINAL_LIBRARY = 'xul'
-
-LOCAL_INCLUDES += [
-    '/widget/android',
-]
+if not CONFIG['MOZ_ARTIFACT_BUILDS']: 
+    # List of stems to generate .cpp and .h files for.  To add a stem, add it to
+    # this list and ensure that $(stem)-classes.txt exists in this directory.
+    generated = [
+        'AndroidRect',
+        'Bundle',
+        'KeyEvent',
+        'MediaCodec',
+        'MotionEvent',
+        'SurfaceTexture',
+        'ViewConfiguration'
+    ]
+    
+    SOURCES += ['!%s.cpp' % stem for stem in generated]
+    
+    EXPORTS += ['!%s.h' % stem for stem in generated]
+    
+    # We'd like to add these to a future GENERATED_EXPORTS list, but for now we mark
+    # them as generated here and manually install them in Makefile.in.
+    GENERATED_FILES += [stem + '.h' for stem in generated]
+    
+    # There is an unfortunate race condition when using generated SOURCES and
+    # pattern rules (see Makefile.in) that manifests itself as a VPATH resolution
+    # conflict: MediaCodec.o looks for MediaCodec.cpp and $(CURDIR)/MediaCodec.cpp,
+    # and the pattern rule is matched but doesn't resolve both sources, causing a
+    # failure.  Adding the SOURCES to GENERATED_FILES causes the sources
+    # to be built at export time, which is before MediaCodec.o needs them; and by
+    # the time MediaCodec.o is built, the source is in place and the VPATH
+    # resolution works as expected.
+    GENERATED_FILES += [f[1:] for f in SOURCES]
+    
+    FINAL_LIBRARY = 'xul'
+    
+    LOCAL_INCLUDES += [
+        '/widget/android',
+    ]