Execution failed for task :app:compileFlutterBuildDebug - java

Hi i don`t know what to do with this problem every time when i want to run my project
this Error:
Launching lib\main.dart on sdk gphone x86 arm in debug mode...
Running Gradle task 'assembleDebug'...
Could not write file to C:\Users\elkha\OneDrive\Документы\crypto_list2\build\app\intermediates\flutter\debug\flutter_assets\shaders/ink_sparkle.frag.spirv
Target debug_android_application failed: ShaderCompilerException: Shader compilation of "C:\Users\elkha\flutter\packages\flutter\lib\src\material\shaders\ink_sparkle.frag" to "C:\Users\elkha\OneDrive\Документы\crypto_list2\build\app\intermediates\flutter\debug\flutter_assets\shaders/ink_sparkle.frag" failed with exit code 1.
impellerc stdout:
impellerc stderr:
Could not write file to C:\Users\elkha\OneDrive\Документы\crypto_list2\build\app\intermediates\flutter\debug\flutter_assets\shaders/ink_sparkle.frag.spirv
FAILURE: Build failed with an exception.
* Where:
Script 'C:\Users\elkha\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1151
* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'C:\Users\elkha\flutter\bin\flutter.bat'' finished with non-zero exit value 1
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 49s
Exception: Gradle task assembleDebug failed with exit code 1
My build.gradle:
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new FileNotFoundException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
compileSdkVersion flutter.compileSdkVersion
ndkVersion flutter.ndkVersion
compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}
kotlinOptions {
jvmTarget = '11'
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.elcode.crypto_list2"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
minSdkVersion flutter.minSdkVersion
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
}
}
}
flutter {
source '../..'
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
My build.gradle2:
buildscript {
ext.kotlin_version = '1.5.30'
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.2.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
repositories {
google()
mavenCentral()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
settings.gradle:
include ':app'
def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
def properties = new Properties()
assert localPropertiesFile.exists()
localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
def flutterSdkPath = properties.getProperty("flutter.sdk")
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"
gradle.properties:
org.gradle.jvmargs=-Xmx1536M
android.useAndroidX=true
android.enableJetifier=true
android.overridePathCheck=true
I run it in Andtoid Studio but in VS it gives me this two error it says that i need to update my jdk in gradle from 1.8 to 11 i search solution for this problem but i don`t found anything , i try to channge it in android studio Project Settings but in gradle settings there is not Gradle project stettings to change jdk, i try to change from build.gradle but it is not work.In stackoverflow i found one solution it say that i need to change my gradle version to older but it not work too.I use emulator and when i run it on chrome it works.Please help.

Faced same exact error impellerc stdout:... when building my sample flutter on my mac laptop.
I was able to resolve this error using the following steps below :
On your Mac, choose Apple menu > System Settings.
Scroll and click Privacy & security, then scroll down to security section.
Click the lock icon to unlock it,
then enter an administrator name and password. Select the sources
from which you’ll allow software to be installed: There should be a
button that says "Allow anyway" which when clicked will prompt for administrator name and password. If not make sure you've cancelled
the error dialog.
Dev Environment:
------------------------------------------------------------
Flutter 3.7.1
Gradle 7.6
Kotlin: 1.7.10
Groovy: 3.0.13
JVM: 17.0.6 (Homebrew 17.0.6+0)
OS: Mac OS X 13.0 aarch64

Related

java.lang.RuntimeException: Unable to load script. Make sure you're either running Metro (run 'npx react-native start') on React-native 0.70.6

Currently, I have completed updating my project to React-Native 0.70.6 (The Latest). Everything is working as expected during development (npm run android) and Apk builds process also generates APK without any error. But when I run my Final APK app suddenly crashes without any error. To detect the reason for crash I have used several debugging tools. Which gives me the error as shown below
java.lang.RuntimeException: Unable to load script.
Make sure you're either running Metro (run 'npx react-native start') or that your bundle 'index.android.bundle' is packaged correctly for release.
at com.facebook.react.bridge.CatalystInstanceImpl.jniLoadScriptFromAssets(Native Method)
at com.facebook.react.bridge.CatalystInstanceImpl.loadScriptFr assets(CatalystInstanceImpl.java:248)
at com.facebook.react.bridge.JSBundleLoader $1.loadScript(JSBundleLoader.java:29)
at com.facebook.react.bridge.CatalystInstanceImpl.runJSBundl e(CatalystInstanceImpl.java:277)
at com.facebook.react.ReactInstanceManager.createReactCont ext(ReactInstanceManager.java:1402)
at com.facebook.react.ReactInstanceManager.access $1200(ReactInstanceManager.java:136)
at com.facebook.react.ReactInstanceManager
$5.run(ReactInstanceManager.java:1108) at java.lang.Thread.run(Thread.java:818)
I searched everywhere about this problem on the web. I read several posts and got several suggestions that I have implemented in my files.
My android/build.gradle file :
buildscript {
ext {
buildToolsVersion = "31.0.0"
minSdkVersion = 21
compileSdkVersion = 31
targetSdkVersion = 31
if (System.properties['os.arch'] == "aarch64") {
ndkVersion = "24.0.8215888"
} else {
ndkVersion = "21.4.7075529"
}
googlePlayServicesAuthVersion = "19.2.0"
firebaseMessagingVersion = "21.1.0"
}
repositories {
google()
mavenCentral()
}
dependencies {
classpath("com.android.tools.build:gradle:7.2.1")
classpath("com.facebook.react:react-native-gradle-plugin")
classpath("de.undercouch:gradle-download-task:5.0.1")
classpath 'com.google.gms:google-services:4.3.14'
}
}
allprojects {
repositories {
maven {
url("$rootDir/../node_modules/react-native/android")
}
maven {
// Android JSC is installed from npm
url("$rootDir/../node_modules/jsc-android/dist")
}
mavenCentral {
content {
excludeGroup "com.facebook.react"
}
}
google()
maven { url 'https://www.jitpack.io' }
}
}
Few configurations of android/app/build.gradle
// other code .....
project.ext.react = [
enableHermes: true,
entryFile: "index.js",
bundleAssetName: "index.android.bundle",
bundleInDebug: true,
bundleInRelease: true
]
def enableSeparateBuildPerCPUArchitecture = true
def enableProguardInReleaseBuilds = true
android {
ndkVersion rootProject.ext.ndkVersion
compileSdkVersion rootProject.ext.compileSdkVersion
defaultConfig {
applicationId "com.myapp"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0"
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
multiDexEnabled true
if (isNewArchitectureEnabled()) {
// We configure the CMake build only if you decide to opt-in for the New Architecture.
externalNativeBuild {
cmake {
arguments "-DPROJECT_BUILD_DIR=$buildDir",
"-DREACT_ANDROID_DIR=$rootDir/../node_modules/react-native/ReactAndroid",
"-DREACT_ANDROID_BUILD_DIR=$rootDir/../node_modules/react-native/ReactAndroid/build",
"-DNODE_MODULES_DIR=$rootDir/../node_modules",
"-DANDROID_STL=c++_shared"
}
}
if (!enableSeparateBuildPerCPUArchitecture) {
ndk {
abiFilters (*reactNativeArchitectures())
}
}
}
}
splits {
abi {
reset()
enable enableSeparateBuildPerCPUArchitecture
universalApk true // If true, also generate a universal APK
include (*reactNativeArchitectures())
}
}
signingConfigs {
debug {
storeFile file('debug.keystore')
storePassword 'android'
keyAlias 'androiddebugkey'
keyPassword 'android'
}
release {
if (project.hasProperty('MYAPP_UPLOAD_STORE_FILE')) {
storeFile file(MYAPP_UPLOAD_STORE_FILE)
storePassword MYAPP_UPLOAD_STORE_PASSWORD
keyAlias MYAPP_UPLOAD_KEY_ALIAS
keyPassword MYAPP_UPLOAD_KEY_PASSWORD
}
}
}
buildTypes {
debug {
signingConfig signingConfigs.debug
}
release {
// Caution! In production, you need to generate your own keystore file.
// see https://reactnative.dev/docs/signed-apk-android.
signingConfig signingConfigs.release
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
}
}
// other code ......
}
Detail of java I am using
Openjdk version "18.0.1.1" 2022-04-22
OpenJDK Runtime Environment Homebrew (build 18.0.1.1+0)
OpenJDK 64-Bit Server VM Homebrew (build 18.0.1.1+0, mixed mode, sharing)
I have tried creating a fully new project on react native 0.70.6 and generated a signed apk which worked fine but didn't work with dependencies.
I had similar problem. Downgrade gradle helps me in my case.
In: android/gradle/wrapper/gradle-wrapper.properties i changed version from 7.5.1 to 7.3.3.
In: android/build.gradle i changed gradle from : classpath("com.android.tools.build:gradle:7.2.1") to
classpath("com.android.tools.build:gradle:7.1.1")

Could not resolve all artifacts for configuration ':classpath'. > Could not resolve com.android.tools.build:gradle:4.1.0

This error came up out of nowhere, until then everything worked fine for months.
Now even creating a new project results the same error without any modification.
flutter run ->
Using hardware rendering with device sdk gphone x86 arm. If you notice graphics artifacts, consider enabling software
rendering with "--enable-software-rendering".
Launching lib/main.dart on sdk gphone x86 arm in debug mode...
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all artifacts for configuration ':classpath'.
> Could not resolve com.android.tools.build:gradle:4.1.0.
Required by:
project :
> Could not resolve com.android.tools.build:gradle:4.1.0.
> Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/4.1.0/gradle-4.1.0.pom'.
> Could not GET 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/4.1.0/gradle-4.1.0.pom'.
> sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 2s
Running Gradle task 'assembleDebug'...
Running Gradle task 'assembleDebug'... Done 4.8s
Exception: Gradle task assembleDebug failed with exit code 1
app level build.gradle ->
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
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.")
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
compileSdkVersion 30
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.utilapp"
minSdkVersion 16
targetSdkVersion 30
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
}
}
}
flutter {
source '../..'
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
project level build.gradle ->
buildscript {
ext.kotlin_version = '1.3.50'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
repositories {
google()
jcenter()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
flutter doctor ->
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.0.1, on macOS 11.1 20C69 darwin-x64, locale en-GB)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[!] Xcode - develop for iOS and macOS
! CocoaPods 1.7.5 out of date (1.10.0 is recommended).
CocoaPods is used to retrieve the iOS and macOS platform side's plugin code that responds to your plugin usage on
the Dart side.
Without CocoaPods, plugins will not work on iOS or macOS.
For more info, see https://flutter.dev/platform-plugins
To upgrade see https://guides.cocoapods.org/using/getting-started.html#installation for instructions.
[✓] Chrome - develop for the web
[✓] Android Studio (version 4.1)
[✓] VS Code (version 1.54.1)
[✓] Connected device (2 available)
! Doctor found issues in 1 category.
Check your internet connection. This error appeared for me when the connection suddenly went down.

Azure Pipeline Gradle build fails for Spring

Im trying to build and deploy a Spring API on Azure via a Yaml pipeline. But i get an error during the spring application gradle build saying.
Error: /home/vsts/work/1/s/gradlew failed with return code: 1
Could not find org.springframework.boot:spring-data-rest-hal-browser:
Expanding the Error,
Starting a Gradle Daemon (subsequent builds will be faster)
> Task :compileJava FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Could not resolve all files for configuration ':compileClasspath'.
> Could not find org.springframework.boot:spring-data-rest-hal-browser:.
Required by:
project :
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 39s
1 actionable task: 1 executed
Error: /home/vsts/work/1/s/gradlew failed with return code: 1
at ChildProcess.<anonymous> (/home/vsts/work/_tasks/Gradle_8d8eebd8-2b94-4c97-85af-839254cc6da4/2.151.0/node_modules/vsts-task-lib/toolrunner.js:639:25)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at maybeClose (internal/child_process.js:886:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
##[error]Error: /home/vsts/work/1/s/gradlew failed with return code: 1
##[section]Finishing: Gradle
Things i have tried.
I have tried changing specifying the versions of spring-data-rest-hal-browser in my project from.
compile("org.springframework.boot:spring-data-rest-hal-browser")
to
compile("org.springframework.boot:spring-data-rest-hal-browser:2.4.0.RELEASE")
and finally
compile("org.springframework.boot:spring-data-rest-hal-browser:3.0.8.RELEASE")
But still the same Error results
This is my current build.gradle file in my repo
plugins {
id 'org.springframework.boot' version '2.1.3.RELEASE'
id 'java'
}
apply plugin: 'io.spring.dependency-management'
group = 'com.test.spring.api'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.11'
repositories {
mavenCentral()
}
configurations {
developmentOnly
runtimeClasspath {
extendsFrom developmentOnly
}
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-rest'
runtimeOnly 'mysql:mysql-connector-java'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
developmentOnly("org.springframework.boot:spring-boot-devtools")
compile("org.springframework.boot:spring-boot-starter-data-rest")
compile("org.springframework.boot:spring-boot-starter-data-jpa")
compile("org.springframework.boot:spring-data-rest-hal-browser")
compile("org.springframework.data:spring-data-rest-webmvc:3.1.5.RELEASE")
}
And this is my current azure-pipelines.yml file
# Maven
# Build your Java project and run tests with Apache Maven.
# Add steps that analyze code, save build artifacts, deploy, and more:
# https://learn.microsoft.com/azure/devops/pipelines/languages/java
trigger:
- master
pool:
vmImage: 'Ubuntu-16.04'
steps:
- task: Gradle#2
inputs:
workingDirectory: '$(system.defaultWorkingDirectory)'
gradleWrapperFile: 'gradlew'
gradleOptions: '-Xmx3072m'
javaHomeOption: 'JDKVersion'
jdkVersionOption: '1.8'
jdkArchitectureOption: 'x64'
publishJUnitResults: false
testResultsFiles: '**/TEST-*.xml'
tasks: 'build'
- task: CopyFiles#2
displayName: 'Copy Files to: Wireframe Directory on development server'
inputs:
SourceFolder: '$(Build.SourcesDirectory)'
TargetFolder: '$(Build.ArtifactStagingDirectory)'
- script:
cd '$(Build.ArtifactStagingDirectory)';
ls
- task: FtpUpload#1
displayName: 'FTP Upload: $(Build.ArtifactStagingDirectory)'
inputs:
credentialsOption: inputs
serverUrl: '[test server url]'
username: '[test username] '
password: '[test password] '
rootDirectory: '$(Build.ArtifactStagingDirectory)'
remoteDirectory: D:\home\site\wwwroot\webapps\ROOT\
preservePaths: true
I want to be able to automatically deploy my spring application to the server URL by pushing my code to it via the Azure devops pipeline which would build and deploy the spring application.
Thanks
So i resolved the issue by making some changes to the build.gradle file and build pipeline using help from the Microsoft Azure Repository for Intellij on Github: see here
My new build.gradle file looks like this:
plugins {
id 'org.jetbrains.intellij' version '0.4.1' apply false
id 'org.springframework.boot' version '2.1.3.RELEASE'
id 'java'
}
/**
*This is task for update Gradle wrapper version.
*/
task wrapper(type: Wrapper) {
gradleVersion = '4.7'
distributionUrl = "https://services.gradle.org/distributions/gradle-${gradleVersion}-all.zip"
}
apply plugin: 'io.spring.dependency-management'
group = 'com.test.spring.api'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'
repositories {
mavenCentral()
}
allprojects {
configurations {
developmentOnly
runtimeClasspath {
extendsFrom developmentOnly
}
}
repositories {
mavenCentral()
}
}
task unitTest(type: Test) {
exclude '**/ApplicationTests/**'
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-rest'
runtimeOnly 'mysql:mysql-connector-java'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
developmentOnly("org.springframework.boot:spring-boot-devtools")
compile("org.springframework.boot:spring-boot-starter-data-rest")
compile("org.springframework.boot:spring-boot-starter-data-jpa")
compile group: 'org.springframework.data', name: 'spring-data-rest-hal-browser', version: '3.0.8.RELEASE'
compile("org.springframework.data:spring-data-rest-webmvc:3.1.5.RELEASE")
}
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
}
tasks.withType(FindBugs) {
ignoreFailures = true
reports {
html { enabled = true }
xml.enabled = !html.enabled
}
}
/**
* Preparing for release build
*/
task prepRelease() {
}
Also modified the azure-pipelines.yml file to include stacktrace and info to assist in debugging other gradle and build errors.
tasks: 'build --stacktrace --info'

ClassNotFound exception on ClassLoader.loadClass method when the class is in different module

I get ClassNotFound Exception in UserServiceApplication.kt file.
Below is my project structure.
Root Project
|
|---settings.gradle
|
|---common (library module) (Spring boot project)
| |
| |--build.gradle
| |--src/main/kotlin/com/simbalarry/common/util/StringValidator.kt
| |--src/main/kotlin/com/simbalarry/common/MainApp.kt
| |
|---user-manager (Spring boot project) (uses common)
| |--build.gradle
| |--src/main/kotlin/somepackage/UserServiceApplication.kt
Contents of all files
RootProject/settings.gradle
include ':common', ':user-manager'
rootProject.name = 'home-cuisine'
common/build.gradle
plugins {
id 'java-library'
id 'org.springframework.boot' version '2.1.3.RELEASE'
id 'org.jetbrains.kotlin.jvm' version '1.2.71'
id 'org.jetbrains.kotlin.plugin.spring' version '1.2.71'
}
apply plugin: 'io.spring.dependency-management'
group = 'com.simbalarry'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'
repositories {
mavenCentral()
}
ext['kotlin.version'] = '1.2.71'
dependencies {
implementation 'org.jetbrains.kotlin:kotlin-reflect'
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8'
}
compileKotlin {
kotlinOptions {
freeCompilerArgs = ['-Xjsr305=strict']
jvmTarget = '1.8'
}
}
common/com/simbalarry/common/util/StringValidator.kt
package com.simbalarry.common.util
class StringValidator {
fun hello(): String {
return "Bye"
}
}
common/com/simbalarry/common/MainApp.kt
package com.simbalarry.common
class MainApp
fun main(args: Array<String>) {
}
user-manager/build.gradle
plugins {
id 'org.springframework.boot' version '2.1.3.RELEASE'
id 'org.jetbrains.kotlin.jvm' version '1.2.71'
id 'org.jetbrains.kotlin.plugin.spring' version '1.2.71'
}
apply plugin: 'io.spring.dependency-management'
group = 'com.simbalarry'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'
test {
useJUnitPlatform()
}
repositories {
mavenCentral()
maven { url 'https://repo.spring.io/snapshot' }
maven { url 'https://repo.spring.io/milestone' }
}
dependencies {
implementation project(':common')
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.jetbrains.kotlin:kotlin-reflect'
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8'
}
compileKotlin {
kotlinOptions {
freeCompilerArgs = ['-Xjsr305=strict']
jvmTarget = '1.8'
}
}
user-manager/UserServiceApplication.kt
package com.simbalarry.usermanager
import com.simbalarry.common.util.StringValidator
class UserServiceApplication
fun main(args: Array<String>) {
println("Hieex")
val stringValidator = StringValidator()
}
When I do gradle bootRun on the user-manager package, I get the following exception
E:\Repos\HC7\user-manager>gradle bootRun
> Task :user-manager:bootRun FAILED
Hieex
Exception in thread "main" java.lang.NoClassDefFoundError: com/simbalarry/common/util/StringValidator
at com.simbalarry.usermanager.UserServiceApplicationKt.main(UserServiceApplication.kt:9)
Caused by: java.lang.ClassNotFoundException: com.simbalarry.common.util.StringValidator
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 1 more
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':user-manager:bootRun'.
> Process 'command 'C:\Program Files\Java\jdk1.8.0_181\bin\java.exe'' finished with non-zero exit value 1
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/5.2.1/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 4s
4 actionable tasks: 1 executed, 3 up-to-date
Can anyone guide me what is going wrong with this project. I had this problem in bigger project but I have pasted the narrowed down problem here.

error: attribute 'com.example.b3rk4.myapplication:layout_constraintTop_toTopOf' not found

When I open Android Studio my first time, I saw "AAPT2 error: check logs for details" this error.
When I check details wrote:
error: attribute
com.example.b3rk4.myapplication:layout_constraintBottom_toBottomOf'
not found.
error: attribute
'com.example.b3rk4.myapplication:layout_constraintLeft_toLeftOf' not
found.
error: attribute
'com.example.b3rk4.myapplication:layout_constraintRight_toRightOf' not
found.
error: attribute
'com.example.b3rk4.myapplication:layout_constraintTop_toTopOf' not
found.
Java compiler: (1 error) error: failed linking file resources.
What i tried already:
Open with administrator
Build->Clean Project and Build->Rebuild Project
Invalidate Caches / Restart
Add android.enableAapt2=false in gradle.properties (When i do this "AAPT2 error: check logs for details" error transforming to "Process 'command 'C:\Users\b3rk4\AppData\Local\Android\Sdk\build-tools\27.0.2\aapt.exe'' finished with non-zero exit value 1" and when i look details:
No resource identifier found for attribute
'layout_constraintBottom_toBottomOf' in package
'com.example.b3rk4.myapplication'
No resource identifier found for attribute
'layout_constraintLeft_toLeftOf' in package
'com.example.b3rk4.myapplication'
No resource identifier found for attribute
'layout_constraintRight_toRightOf' in package
'com.example.b3rk4.myapplication'
No resource identifier found for attribute
'layout_constraintTop_toTopOf' in package
'com.example.b3rk4.myapplication'
Java compiler: (3 errors)
Caused by: java.util.concurrent.ExecutionException:
com.android.ide.common.process.ProcessException: Error while executing
process
C:\Users\b3rk4\AppData\Local\Android\Sdk\build-tools\27.0.2\aapt.exe
with arguments {package -f --no-crunch -I
C:\Users\b3rk4\AppData\Local\Android\Sdk\platforms\android-27\android.jar
-M \?\C:\Users\b3rk4\Desktop\MyApplication\app\build\intermediates\manifests\full\debug\AndroidManifest.xml
-S C:\Users\b3rk4\Desktop\MyApplication\app\build\intermediates\res\merged\debug
-m -J \?\C:\Users\b3rk4\Desktop\MyApplication\app\build\generated\source\r\debug
-F C:\Users\b3rk4\Desktop\MyApplication\app\build\intermediates\res\debug\resources-debug.ap_
--custom-package com.example.b3rk4.myapplication -0 apk --preferred-density 420dpi --output-text-symbols \?\C:\Users\b3rk4\Desktop\MyApplication\app\build\intermediates\symbols\debug
--no-version-vectors}
Caused by: com.android.ide.common.process.ProcessException: Error
while executing process
C:\Users\b3rk4\AppData\Local\Android\Sdk\build-tools\27.0.2\aapt.exe
with arguments {package -f --no-crunch -I
C:\Users\b3rk4\AppData\Local\Android\Sdk\platforms\android-27\android.jar
-M \?\C:\Users\b3rk4\Desktop\MyApplication\app\build\intermediates\manifests\full\debug\AndroidManifest.xml
-S C:\Users\b3rk4\Desktop\MyApplication\app\build\intermediates\res\merged\debug
-m -J \?\C:\Users\b3rk4\Desktop\MyApplication\app\build\generated\source\r\debug
-F C:\Users\b3rk4\Desktop\MyApplication\app\build\intermediates\res\debug\resources-debug.ap_
--custom-package com.example.b3rk4.myapplication -0 apk --preferred-density 420dpi --output-text-symbols \?\C:\Users\b3rk4\Desktop\MyApplication\app\build\intermediates\symbols\debug
--no-version-vectors}
Caused by: org.gradle.process.internal.ExecException: Process 'command
'C:\Users\b3rk4\AppData\Local\Android\Sdk\build-tools\27.0.2\aapt.exe''
finished with non-zero exit value 1
Changed to classpath 'com.android.tools.build:gradle:3.0.0'
Changed to buildToolsVersion "27.0.2"
I installed Java jdk, Android Studio, Sdk thinks very carefully.
Added path C:\Users\b3rk4\AppData\Local\Android\Sdk\platform-tools and C:\Users\b3rk4\AppData\Local\Android\Sdk
I unistaled everythink and installed again be carefully and noting changed...
Can you help me please? I were using Android Studio normally 1 month ago and I format my computer and then I can't use any more
My build.gradle (project):
// 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.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
My build.gradle (Module: app):
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
buildToolsVersion "27.0.2"
defaultConfig {
applicationId "com.example.b3rk4.myapplication"
minSdkVersion 15
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'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
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'
}

Categories