react-native-extra-dimensions-android icon indicating copy to clipboard operation
react-native-extra-dimensions-android copied to clipboard

Android build fail

Open Jeijie opened this issue 5 years ago • 11 comments

Android build fail, please help

A problem occurred evaluating project ':react-native-extra-dimensions-android'.

Cannot get property 'compileSdkVersion' on extra properties extension as it do es not exist

Environment: OS: Windows 7 Node: 8.12.0 Yarn: 1.9.4 npm: 6.4.1 Watchman: Not Found Xcode: N/A Android Studio: Not Found

Packages: (wanted => installed) react: 16.3.1 => 16.3.1 react-native: ^0.55.4 => 0.55.4

Jeijie avatar Mar 04 '19 07:03 Jeijie

Just getting ready for work. I can patch this as soon as I get on the train. Theres another open issue showing what I need to do. You can apply the same fix locally if you know how

Sunhat avatar Mar 04 '19 07:03 Sunhat

I manually changed the build. gradle file to compile it, but now another issue occurred, It's work RN 0.55.4?

screenshot_2019-03-04-16-58-45

Jeijie avatar Mar 04 '19 09:03 Jeijie

Hey Jeijie, did you manage to fix this? It looks like you've got ExtraDimensions installed twice looking at the 2 at the end of the name?

Sunhat avatar Mar 04 '19 14:03 Sunhat

Did you fix it? I have same problem in React-Native v0.57

Cumbermiao avatar Mar 13 '19 06:03 Cumbermiao

same problem in React Native 0.55.4

fredikey avatar Mar 18 '19 14:03 fredikey

I'll look into this now - Just getting a coffee. In case this is the problem, try re-building the project

Sunhat avatar Mar 18 '19 14:03 Sunhat

@Jeijie try this again with the latest master. Use import { getRealWindowHeight } from ''react-native-extra-dimensions-android otherwise send the whole code.

EyMaddis avatar Mar 20 '19 21:03 EyMaddis

@EyMaddis ,thanks ,I try your method, but it not works.

my code: import { getRealWindowHeight } from 'react-native-extra-dimensions-android' componentDidMount() { console.warn('real width,height',getRealWindowHeight()); }

image

Jeijie avatar Mar 21 '19 01:03 Jeijie

I have solved it by replacing build.gradle in node_modules/react-native-extra-dimensions-android/android

def safeExtGet(prop, fallback) {
    rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
}

apply plugin: 'com.android.library'

def DEFAULT_COMPILE_SDK_VERSION = 27
def DEFAULT_BUILD_TOOLS_VERSION = "27.0.3"
def DEFAULT_TARGET_SDK_VERSION = 26
def DEFAULT_SUPPORT_LIB_VERSION = "27.0.2"

android {
    compileSdkVersion rootProject.hasProperty('compileSdkVersion') ? rootProject.compileSdkVersion : DEFAULT_COMPILE_SDK_VERSION
    buildToolsVersion rootProject.hasProperty('buildToolsVersion') ? rootProject.buildToolsVersion : DEFAULT_BUILD_TOOLS_VERSION

    defaultConfig {
        minSdkVersion 16
        targetSdkVersion rootProject.hasProperty('targetSdkVersion') ? rootProject.targetSdkVersion : DEFAULT_TARGET_SDK_VERSION
        versionCode 1
        versionName "1.0"
        ndk {
            abiFilters "armeabi-v7a", "x86"
        }
    }
}

dependencies {
    implementation 'com.facebook.react:react-native:+'
}

Cumbermiao avatar Mar 21 '19 03:03 Cumbermiao

just add these to root build.gradle

ext.supportLibVersion = '28.0.0'
ext.compileSdkVersion = 28
ext.buildToolsVersion = '28.0.3'
ext.minSdkVersion = 21
ext.targetSdkVersion = 28

alexandrius avatar Mar 28 '19 16:03 alexandrius

Ahh crap I fixed this, but didn't publish on npm. fml.

Sunhat avatar Mar 30 '19 23:03 Sunhat