0

Today, I'm newbie in android studio.

I have updated the latest version of andriod studio

When I have opened an old projekct and started compiling the project I retrieve a error message that is "Cause: failed to find target with hash string 'android-N'"

What should I do in order to use this old project in the updated android studio?

Thank you!

enter image description here

enter image description here

enter image description here

enter image description here

Sourcecode from the file build.gradle

// 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.1.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
HelloWorld1
  • 13,688
  • 28
  • 82
  • 145

2 Answers2

1

android N is not installed in your sdk Just click on the link written in the error:

Open Android SDK Manager and it will show you the dialogs that will help you to install the required sdk for your project.

Abdou
  • 43
  • 6
  • Thank you for your help! I can't find a android N in the sdk manager. What part am I missing? – HelloWorld1 Dec 17 '16 at 11:18
  • android 7.0 Nougat is android N if you still have the problem try install the 7.1.1 – Abdou Dec 17 '16 at 11:22
  • 1
    hey try to change this in your build.gradle if its `compileSdkVersion 'android-N'` make it `compileSdkVersion 24` and change targetSdkVersion to 24 – Abdou Dec 17 '16 at 11:51
  • I can't find the text compileSdkVersion in gradle. What file in Gradle Script can I find it? I hav now uploaded a new picture. Same problem occur when I have updated the android sdk. Thank you! – HelloWorld1 Dec 17 '16 at 12:21
  • copy and past your build.gradle here's how to find it [image] (http://www.android-examples.com/wp-content/uploads/2016/05/build-gradle.png) – Abdou Dec 17 '16 at 12:25
  • not that one this is the top-level build you need the build.gradle (module:app) – Abdou Dec 17 '16 at 12:36
  • Unfortunately, there is no build.gradle (module: app) in the old project. – HelloWorld1 Dec 17 '16 at 12:45
  • you need to find a way how to add one its important for the app to work properly . and now paste your manifest.xml file – Abdou Dec 17 '16 at 12:54
  • Today, I'm using material about how to use android by reading a book. This author has provided some material that you can use as tutorial's coding material. – HelloWorld1 Dec 17 '16 at 13:16
  • One of the project do not work that is why I have uploaded my question that is stackoverflow. – HelloWorld1 Dec 17 '16 at 13:16
  • It is one of the project from the material that is defect and the remaining project works well. – HelloWorld1 Dec 17 '16 at 13:16
  • Recently, I tried new and existing project that use and old api version. Before and after updating the android studie it works perfectly in order to use the remaining project without error message android N in relation to bundle. Thank you for your time and patience for helping my case! – HelloWorld1 Dec 17 '16 at 13:16
0

you have to change in app/build.gradle before opening your project compileSdkVersion 'N' buildToolsVersion '24.0.0 rc1' targetSdkVersion 'N'

to compileSdkVersion '24' buildToolsVersion '24.0.0' targetSdkVersion '24'