1
votes

I'm trying to build Messaging app for Android 6.... I've imported packages/app/Messaging into Android Studio... And created following build.gradle file:

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
       classpath 'com.android.tools.build:gradle:1.3.+'
    }
}

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

    sourceSets {
        main {
            manifest.srcFile 'AndroidManifest.xml'
            java.srcDirs = ['src']
            resources.srcDirs = ['src']
            aidl.srcDirs = ['src']
            renderscript.srcDirs = ['src']
            res.srcDirs = ['res']
            assets.srcDirs = ['assets']
        }

        // Move the tests to tests/java, tests/res, etc...
        instrumentTest.setRoot('tests')

        // Move the build types to build-types/<type>
        // For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
        // This moves them out of them default location under src/<type>/... which would
        // conflict with src/ being used by the main source set.
        // Adding new build types or product flavors should be accompanied
        // by a similar customization.
        debug.setRoot('build-types/debug')
        release.setRoot('build-types/release')
    }

    defaultConfig {
        applicationId "com.android.messaging"
        minSdkVersion 23
        targetSdkVersion 23

        ndk {
            moduleName "libgiftranscode"
        }

        repositories {
            mavenCentral()
        }

        testApplicationId "com.android.messaging.test"
        testInstrumentationRunner "android.test.InstrumentationTestRunner"
    }

    dependencies {
        compile "com.android.support:support-v4:+"
        compile "com.android.support:appcompat-v7:+"
        compile "com.android.support:recyclerview-v7:+"
        compile "com.android.support:palette-v7:+"
        compile "com.android.support:support-v13:+"
        compile group: 'com.google.guava', name: 'guava', version: '18.0'
        compile group: 'com.google.code.findbugs', name: 'jsr305', version: '3.0.0'
        compile group: 'com.googlecode.libphonenumber', name: 'libphonenumber', version: '3.5'
        compile group: 'com.klinkerapps', name: 'android-chips', version: '1.0.2'
        // https://mvnrepository.com/artifact/com.google.collections/google-collections
        compile group: 'com.google.collections', name: 'google-collections', version: '1.0'
        // https://mvnrepository.com/artifact/com.1gravity/android-colorpicker
        compile group: 'com.1gravity', name: 'android-colorpicker', version: '2.0.1'
        // https://mvnrepository.com/artifact/com.googlecode.ez-vcard/ez-vcard
        compile group: 'com.googlecode.ez-vcard', name: 'ez-vcard', version: '0.4.1'
        // https://mvnrepository.com/artifact/javax.annotation/jsr250-api
        compile group: 'javax.annotation', name: 'jsr250-api', version: '1.0'
        // https://mvnrepository.com/artifact/com.google.guava/guava-annotations
        compile group: 'com.google.guava', name: 'guava-annotations', version: 'r03'






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

It build mostly ok but at the end i'm getting:

Starting process 'command '/home/vadim/Android/Sdk/build-tools/23.0.2/aapt''. Working directory: /home/vadim/work/Messaging2 Command: /home/vadim/Android/Sdk/build-tools/23.0.2/aapt package -f --no-crunch -I /home/vadim/Android/Sdk/platforms/android-23/android.jar -M /home/vadim/work/Messaging2/build/intermediates/manifests/full/debug/AndroidManifest.xml -S /home/vadim/work/Messaging2/build/intermediates/res/merged/debug -A /home/vadim/work/Messaging2/build/intermediates/assets/debug -m -J /home/vadim/work/Messaging2/build/generated/source/r/debug -F /home/vadim/work/Messaging2/build/intermediates/res/resources-debug.ap_ --debug-mode --custom-package com.android.messaging -0 apk --output-text-symbols /home/vadim/work/Messaging2/build/intermediates/symbols/debug Successfully started process 'command '/home/vadim/Android/Sdk/build-tools/23.0.2/aapt'' /home/vadim/work/Messaging2/res/values/styles.xml:2 : Error retrieving parent for item: No resource found that matches the given name 'PhotoViewTheme.Translucent'.

:processDebugResources FAILED :processDebugResources (Thread[main,5,main]) completed. Took 1.175 secs.

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':processDebugResources'.

    com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/home/vadim/Android/Sdk/build-tools/23.0.2/aapt'' finished with non-zero exit value 1

  • Try: Run with --stacktrace option to get the stack trace. Run with --debug option to get more log output.

The missing style 'PhotoViewTheme.Translucent' seems to reside in the appcompat library but my build does not find it... Any ideas on how to fix it?

Thanks

2
Is your SDK up to date?Zoe
Yes... This was the first thing i've checkedVadim Lebedev

2 Answers

1
votes

I'm sorry to disappoint you but you can not import specific file from the source and build it inside your Gradle as a regular apk.
System apps are built inside linux environment with GNU make and not with regular apks Gradle.
To compile a system app you need to build the whole AOSP first. (Takes about a week if it's your first time)

I would search for an Gradle version off the app ( or similar app) online.

0
votes

Your output states the error:

/home/vadim/work/Messaging2/res/values/styles.xml:2 : Error retrieving parent for item: No resource found that matches the given name 'PhotoViewTheme.Translucent'

This simply means that the app is missing the certain style that is a parent to another.

Have a look at the Android.mk file in the messaging app source. It clearly mentions

LOCAL_RESOURCE_DIR += frameworks/opt/photoviewer/res

which means you need these resources in your source too. Just google for PhotoViewTheme.Translucent and add that style/theme up in the app. Nir Duan is right to an extent, but you can always build source apps in android studio if you have the skill to make it gradle-compliant. Here is the code from AOSP which you might want to look at. Add it to styles.xml or another file. Cheers!