1

I am trying to import a project in android Studio but if Fails

Following is the project:

project

I get this error:

> C:\xampp\htdocs\freedom\Android-IP-Camera-master\spydroid-ipcamera-master\app\build\intermediates\res\merged\debug\values-ldltr-v21\values-ldltr-v21.xml
> Error:(3) Error retrieving parent for item: No resource found that
> matches the given name 'android:Widget.Material.Spinner.Underlined'.
> Error:(3) Error retrieving parent for item: No resource found that
> matches the given name 'android:Widget.Material.Spinner.Underlined'.
> C:\xampp\htdocs\freedom\Android-IP-Camera-master\spydroid-ipcamera-master\app\build\intermediates\res\merged\debug\values-v21\values-v21.xml
> Error:(17) Error retrieving parent for item: No resource found that
> matches the given name 'android:TextAppearance.Material.Inverse'.

EDIT:

Below are both gradle files of the project.

build.gradle (Module:app):

apply plugin: 'com.android.application'

android {
    compileSdkVersion 19
    buildToolsVersion "25.0.3"

    defaultConfig {
        applicationId "net.majorkernelpanic.spydroid"
        minSdkVersion 14
        targetSdkVersion 19
    }

    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt'
        }
    }
}

dependencies {
    compile 'com.android.support:support-v4:19.1.0'
    compile 'com.google.android.gms:play-services:+'
    compile files('libs/acra-4.4.0.jar')
    compile files('libs/GoogleAdMobAdsSdk-6.1.0.jar')
    compile files('libs/sc-light-jdk15on-1.47.0.2.jar')
    compile files('libs/scpkix-jdk15on-1.47.0.2.jar')
    compile files('libs/scprov-jdk15on-1.47.0.2.jar')
}

build.gradle(Project: spydroid-ipcamera-master):

// 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.3'
    }
}

allprojects {
    repositories {
        jcenter()
    }
}
utdev
  • 3,942
  • 8
  • 40
  • 70

2 Answers2

0

First of all change

compile files('libs/acra-4.4.0.jar')
compile files('libs/GoogleAdMobAdsSdk-6.1.0.jar')
compile files('libs/sc-light-jdk15on-1.47.0.2.jar')
compile files('libs/scpkix-jdk15on-1.47.0.2.jar')
compile files('libs/scprov-jdk15on-1.47.0.2.jar')

to compile fileTree(include: ['*.jar'], dir: 'libs')

second try to use the app combat library, cause some resources are missing

compile 'com.android.support:appcompat-v7:25.4.0'

or you can up your compileSdkVersion && targetSdkVersion to 21+

  • Hi I increased the sdk and now I get this error https://kopy.io/M3hEk if you mind having a look at it please – utdev Jun 21 '17 at 14:42
  • You need to make your app multidex, cause you have imported all the Google play libraries. Also, dont use jars just add then as dependencies into gradle. Select from here the libs you want: https://developers.google.com/android/guides/setup also this is how you can make your app multidex : https://developer.android.com/studio/build/multidex.html Dont up your target SDK version if you dont want, just add the compile 'com.android.support:appcompat-v7:25.4.0' to your dependencies – Stilianos Tzouvaras Jun 21 '17 at 14:45
  • how do I make the app multidex and how should my gradle look like afterwards? – utdev Jun 21 '17 at 14:45
  • I just gave you the necessary instructions to figure it out, if you need anything else let me know. Check my comment above for edit. – Stilianos Tzouvaras Jun 21 '17 at 14:53
0

I import related project and chages some thing in build.gradle to last version that recomended by AS.
Change your build.gradle (Module:app) with this and try:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion "26.0.0"

defaultConfig {
    applicationId "net.majorkernelpanic.spydroid"
    minSdkVersion 14
    targetSdkVersion 19
}

buildTypes {
    release {
        minifyEnabled true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt'
       }
    }
}
dependencies {
    compile 'com.android.support:support-v4:25.3.1'
    compile 'com.google.android.gms:play-services:11.0.0'
    compile files('libs/acra-4.4.0.jar')
    compile files('libs/GoogleAdMobAdsSdk-6.1.0.jar')
    compile files('libs/sc-light-jdk15on-1.47.0.2.jar')
    compile files('libs/scpkix-jdk15on-1.47.0.2.jar')
    compile files('libs/scprov-jdk15on-1.47.0.2.jar')
}

In my case project sync and run perfectly.

UPDATE:
I'll add that you must also change deprecated apache HttpClient with the new HttpURLConnection.
For this purpose add below code to your build.gradle (Module:app) :

useLibrary 'org.apache.http.legacy'

Naruto Uzumaki
  • 2,019
  • 18
  • 37
  • this line `compile 'com.android.support:support-v4:25.3.1'` shows me an error all libraries must be the exact same version, did you changed anything else? – utdev Jun 21 '17 at 14:59
  • @utdev show me this error, too. Project runs but this issue can lead to runtime crashes. You can see this [link](https://stackoverflow.com/questions/42374151/all-com-android-support-libraries-must-use-the-exact-same-version-specification) – Naruto Uzumaki Jun 21 '17 at 15:06
  • well the current error is following `java.lang.RuntimeException: Unable to start activity ComponentInfo{net.majorkernelpanic.spydroid/net.majorkernelpanic.spydroid.ui.SpydroidActivity}: android.view.InflateException: Binary XML file line #52: Binary XML file line #52: Error inflating class com.google.ads.AdView` , didn't you get any errors? – utdev Jun 22 '17 at 07:39
  • ok I fixed this, I deleted in the xml view part an ad, but I still cannot stream can you stream? – utdev Jun 22 '17 at 07:45