question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

An error will occur in the build. What kind of cause can be considered?

See original GitHub issue

The following error occurs at build time.
What kind of cause can be considered?
I succeeded in building the example application of this repository.
SDK Version is 5.0.1

Error:Exception in thread "main" java.lang.IllegalStateException: Expected a load for Landroid/view/View$OnClickListener; to set up parameter 1 for com/linecorp/linesdk/widget/LoginButton$$Lambda$3 but got -1
	at com.google.common.base.Preconditions.checkState(Preconditions.java:756)
	at com.google.devtools.build.android.desugar.LambdaDesugaring$InvokedynamicRewriter.attemptAllocationBeforeArgumentLoads(LambdaDesugaring.java:543)
	at com.google.devtools.build.android.desugar.LambdaDesugaring$InvokedynamicRewriter.visitInvokeDynamicInsn(LambdaDesugaring.java:427)
	at org.objectweb.asm.ClassReader.readCode(ClassReader.java:1623)
	at org.objectweb.asm.ClassReader.readMethod(ClassReader.java:1126)
	at org.objectweb.asm.ClassReader.accept(ClassReader.java:698)
	at org.objectweb.asm.ClassReader.accept(ClassReader.java:500)
	at com.google.devtools.build.android.desugar.Desugar.desugarClassesInInput(Desugar.java:477)
	at com.google.devtools.build.android.desugar.Desugar.desugarOneInput(Desugar.java:361)
	at com.google.devtools.build.android.desugar.Desugar.desugar(Desugar.java:314)
	at com.google.devtools.build.android.desugar.Desugar.main(Desugar.java:711)

FAILURE: Build failed with an exception.

build.gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.2'
        

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

allprojects {
    repositories {
        google()
        jcenter()
        flatDir {
            dirs 'libs'
        }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

app/build.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 27
    buildToolsVersion '27.0.3'
    defaultConfig {
        applicationId "com.example.xxxxx.linelogintest"
        minSdkVersion 23
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support:customtabs:27.1.1'
    implementation('com.madgag.spongycastle:prov:1.58.0.0')
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation(name:'line-sdk-5.0.1', ext:'aar')
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
sgamerwcommented, Jan 18, 2019

It works fine after I update com.android.tools.build:gradle.

classpath 'com.android.tools.build:gradle:3.1.2' is the version of this rep uses.

2reactions
LiYing2010commented, Jan 15, 2019

We used lambda in LINE SDK, but looks like your development environment(Android Studio 3.1 or newer?) does not support lambda.

Please try the following:

  1. create a gradle.properties file in your project root path
  2. add the following setting in this file: android.enableD8.desugaring=true

We added the same setting in this repo, that’s why our sample application and LINE SDK itself could be compiled.

Please refer to this article for more detail: Android Studio Switched to New D8 Compiler

Read more comments on GitHub >

github_iconTop Results From Across the Web

Build Verification Testing (BVT Testing) Complete Guide
Build Verification Test is a set of tests run on every new build to verify that the build is testable before it is...
Read more >
Practices of Science: Scientific Error
There are two types of errors: random and systematic. Random error occurs due to chance. There is always some variability when a measurement...
Read more >
Types of Errors in Java with Examples - GeeksforGeeks
The most common errors can be broadly classified as follows: 1. Run Time Error: Run Time errors occur or we can say, are...
Read more >
BVT Testing: Everything You Need To Know [2022] - TestGrid
It is not always true that build verification testing fails because of a developer. There are numerous reasons why BAT test cases fail, ......
Read more >
How to handle root cause analysis of software defects
If the defect resulted from design error, for example, developers can review the design and requirements documents to make corrections. If a ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found