6

I do not consider this question to be a duplicate of this and this questions since they are mainly answered by this link and that is not adaptable for later versions of AS.

I can find good information on how to integrate Android NDK with Eclipse, but that Eclipse and ADT is now considered deprecated by Google.

When following the instructions to setup a project for the experimental gradle plugin I get numerous errors in the editor of type cannot Resolve symbol for all the new additions as well as the error posted below after the build.

The build.gradle in project.

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

allprojects {
    repositories {
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

And the build.gradle in app

apply plugin: 'com.android.model.application'

model{
    android {
         compileSdkVersion = 22
        buildToolsVersion = "23.0.1"

         defaultConfig.with {
             applicationId = "se.einarsundgren.gstreamandroiddemo"
             minSdkVersion.apiLevel = 22
            targetSdkVersion.apiLevel = 22
            versionCode = 1
            versionName = "1.0"

             buildConfigFields.with {
                 create() {
                     type = "int"
                     name = "VALUE"
                     value = "1"
                }
            }
        }

         android.buildTypes {
             release {
                 minifyEnabled = false
                 proguardFiles += file('proguard-rules.pro')
            }
        }

         android.productFlavors {
             create("flavor1") {
                 applicationId = 'com.app'
            }
        }

         android.sources{
             main {
                 java {

                   source {
                         srcDir 'src'
                      }
                  }
            }
        }

        android.ndk {
            moduleName = "native"
        }
 }
}

dependencies {
        compile fileTree(dir: 'libs', include: ['*.jar'])
        compile 'com.android.support:appcompat-v7:22.2.0'
}

The error I get when cleaning and rebuilding the project:

Error:A problem occurred configuring root project 'GstreamAndroidDemo'.

Could not resolve all dependencies for configuration ':classpath'. Could not resolve com.android.tools.build:gradle-experimental:0.2.0. Required by: :GstreamAndroidDemo:unspecified Could not resolve com.android.tools.build:gradle-experimental:0.2.0. Could not get resource 'https://jcenter.bintray.com/com/android/tools/build/gradle-experimental/0.2.0/gradle-experimental-0.2.0.pom'. Could not GET 'https://jcenter.bintray.com/com/android/tools/build/gradle-experimental/0.2.0/gradle-experimental-0.2.0.pom'. peer not authenticated

How do I integrate the NDK with a project in Android Studio? The previously linked questions have answers valid for an earlier version (pre 1.3) and the instructions are not adaptable for AS 1.4

Community
  • 1
  • 1
Einar Sundgren
  • 4,325
  • 9
  • 40
  • 59
  • You might wish to explain, in detail, what problems you are having with those instructions when attempting to apply them to Android Studio 1.4. I do not see any references to the NDK in the various Android Studio 1.4 releases (preview, RC, etc.). – CommonsWare Oct 30 '15 at 22:42
  • Your screenshot has a text field to specify NDK location, and a link to help you download NDK if you don't have it on your disk. What is missing for you? – Alex Cohn Oct 31 '15 at 06:38
  • @CommonsWare I added to and changed the error description. You were right that the settings panel existed. The build errors though are prevalent. I didn't add them earlier. – Einar Sundgren Oct 31 '15 at 10:22

2 Answers2

3

that this setting where you can point to the location of the NDK is not included in the later versions.

Yes, it is, at least on Android Studio 1.4.1 on Linux:

Project Structure Dialog, SDK Location Category

How do I integrate the NDK with a project in Android Studio?

As far as I am aware, you follow the instructions.


UPDATE: With regard to your gradle-experimental problems, 0.2.0 and newer versions certainly show up in jcenter when you view their Web site. Make sure that you have followed the rest of the instructions, such as using Gradle 2.5.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
2

Yes it is. The setting is there on Android Studio 1.5 preview 2 in Windows 10 as well.

NDK Location

phxhawke
  • 2,581
  • 23
  • 17