konifar / droidkaigi2018-flutter

The unofficial conference app for DroidKaigi 2018 Tokyo
https://itunes.apple.com/app/id1341774412
Apache License 2.0
508 stars 103 forks source link

Error when flutter run -d #64

Open carlosbdw opened 6 years ago

carlosbdw commented 6 years ago

Initializing gradle... 1.2s Resolving dependencies...

FAILURE: Build failed with an exception.

gen0083 commented 6 years ago

I faced same error. The causes that there is not committed key.properties file which using in generating release build apk. comment out some lines in android/app/build.gradle like below then you can build project as debug mode.

android/app/build.gradle

def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
    localPropertiesFile.withInputStream { stream ->
        localProperties.load(stream)
    }
}

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
    throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

//def keystorePropertiesFile = rootProject.file("key.properties")
//def keystoreProperties = new Properties()
//keystoreProperties.load(new FileInputStream(keystorePropertiesFile))

android {
    compileSdkVersion 27
    buildToolsVersion '27.0.3'

    lintOptions {
        disable 'InvalidPackage'
    }

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "com.droidkaigi2018"
        minSdkVersion 16
        targetSdkVersion 25
        versionCode 10000
        versionName "1.0.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }

    signingConfigs {
//        release {
//            keyAlias keystoreProperties['keyAlias']
//            keyPassword keystoreProperties['keyPassword']
//            storeFile file(keystoreProperties['storeFile'])
//            storePassword keystoreProperties['storePassword']
//        }
    }

    buildTypes {
        release {
            // Signing with the debug keys for now, so `flutter run --release` works.
//            signingConfig signingConfigs.release
        }

        profile {
            matchingFallbacks = ['debug', 'release']
        }
    }
}

flutter {
    source '../..'
}

dependencies {
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}

apply plugin: 'com.google.gms.google-services'
konifar commented 6 years ago

Sorry, I will check :eyes: