unable to resolve class com.android.build.OutputFile in react native - react-native

How can i solved the error?
unable to resolve class com.android.build.OutputFile.
in path: android/app/build.gradle
I also check and i have the:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath("com.android.tools.build:gradle:4.1.0") // <- this line
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
like some pepole said to add and its not solved the problem

Related

Kotlin with gradle build system cant add JRAW compile "net.dean.jraw:JRAW:1.1.0"

I am all new to Kotlin and gradle and wanted to create a reddit scraper app for fun.
Cant get the guide from this page to work.
https://mattbdean.gitbooks.io/jraw/content/quickstart.html
The guide tells me to put this in the gradle file:
repositories {
jcenter()
}
dependencies {
compile "net.dean.jraw:JRAW:$jrawVersion"
}
But when i put that in my buid.gardle.kts file the ide reports an error
See image below of where the error occurs. The error message is Unexpected tokens.
Found the answer to my question, simply had to add in the variable in the gradle file...
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
var jrawVersion = "1.1.0" //needed to add this in obviously
plugins {
kotlin("jvm") version "1.4.21"
application
}
group = "me.jeppe"
version = "1.0"
repositories {
mavenCentral()
jcenter()
}
dependencies {
testImplementation(kotlin("test-junit"))
compile ("net.dean.jraw:JRAW:$jrawVersion")
}
tasks.test {
useJUnit()
}
tasks.withType<KotlinCompile>() {
kotlinOptions.jvmTarget = "1.8"
}
application {
mainClassName = "MainKt"
}

Default buildDir for kotlin projects

I'm trying to add documentation to my project with dokka https://kotlinlang.org/docs/reference/kotlin-doc.html
I'm not quite able to figure out where the javadocs are located after doing a successful ./gradlew build.
It says there they should be in $buildDir/javadoc but I'm not sure where buidlDir is pointing to.
My build.gradle file is this:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.github.jengelman.gradle.plugins:shadow:2.0.4'
}
}
plugins {
id 'org.jetbrains.kotlin.jvm' version '1.3.11'
id 'org.jetbrains.dokka' version '0.9.18'
// id("org.jmailen.kotlinter") version "1.23.1"
}
dokka {
outputFormat = 'html'
outputDirectory = "$buildDir/javadoc"
}
group 'com.github.me.dynamik'
version '1.0-SNAPSHOT'
apply plugin: 'application'
apply plugin: 'kotlin'
apply plugin: 'java'
apply plugin: 'com.github.johnrengelman.shadow'
mainClassName = 'com.github.me.dynamik.interpreter.MainEntryKt'
repositories {
mavenCentral()
jcenter()
maven { setUrl("https://dl.bintray.com/hotkeytlt/maven") }
maven {
url = uri("https://plugins.gradle.org/m2/")
}
}
configurations {
ktlint
}
dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
compile 'com.github.h0tk3y.betterParse:better-parse-jvm:0.4.0-alpha-3'
// https://mvnrepository.com/artifact/junit/junit
testCompile group: 'junit', name: 'junit', version: '4.4'
implementation 'com.github.ajalt:clikt:1.7.0'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.2.0'
}
compileKotlin {
kotlinOptions.jvmTarget = "1.8"
}
compileTestKotlin {
kotlinOptions.jvmTarget = "1.8"
}
run {
standardInput = System.in
}
jar {
manifest {
attributes 'Main-Class': 'com.github.me.dynamik.interpreter.MainEntryKt'
}
}
test {
// Always run tests, even when nothing changed.
dependsOn 'cleanTest'
// Show test results.
testLogging {
events "passed", "skipped", "failed"
}
}
I'd love a pointer or two in the right direction.
Thank you!
In Gradle the project property buildDir points by default to the subdirectory build of your project directory.
The dokka output directory javadoc may be missing in buildDir because the dokka task has never run before. Your build.gradle file seems not to have any dependencies on the dokka task or its output, so it isn't triggered when you're running build or assemble tasks. You can try running it explicitly: ./gradlew dokka or add a dependency on that task to some other lifecycle task, e.g
assemble.dependsOn(dokka)

A problem occurred configuring project ':app'

Getting error when trying react-native run-android.I don't know why I'm getting this error.
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugApk'.
> A problem occurred configuring project ':react-native-vector-icons'.
> Could not resolve all dependencies for configuration ':react-native-vector-icons:classpath'.
> Could not find any matches for com.android.tools.build:gradle:2.3.+ as no versions of com.android.tools.build:gradle are available.
android\build.gradle is as follows.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenLocal()
jcenter()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is
installed from npm
url "$rootDir/../node_modules/react-native/android"
}
}
}
gradle version: 3.3,
plugin:2.2.3
Upgrade react-native-vector-icons: "^6.0.2" in package.json
Then run npm i react-native-vector-icons
As a last step, cd android && ./gradlew clean.
Change dependencies from:
dependencies {
implementation "com.facebook.react:react-native:${safeExtGet('reactNativeVersion', '+')}"
}
to:
dependencies {
compile "com.facebook.react:react-native:${safeExtGet('reactNativeVersion', '+')}"
}
also change buildscript dependencies to use: classpath 'com.android.tools.build:gradle:2.2.3'
and maven { url "https://dl.bintray.com/android/android-tools/" } instead of google()
So your ../node_modules/react-native-vector-icons/android/build.gradle should look like this:
buildscript {
repositories {
maven { url "https://dl.bintray.com/android/android-tools/" }
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
}
}
apply plugin: 'com.android.library'
def safeExtGet(prop, fallback) {
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
}
android {
compileSdkVersion safeExtGet('compileSdkVersion', 26)
buildToolsVersion safeExtGet('buildToolsVersion', '26.0.3')
defaultConfig {
minSdkVersion safeExtGet('minSdkVersion', 16)
targetSdkVersion safeExtGet('targetSdkVersion', 26)
versionCode 1
versionName "1.0"
}
lintOptions {
abortOnError false
}
}
repositories {
mavenCentral()
}
dependencies {
compile "com.facebook.react:react-native:${safeExtGet('reactNativeVersion', '+')}"
}

Google Play Services Ads?

I cant add android studio App Admob to an app.
grandle Could not download this
'https://dl.google.com/dl/android/maven2/com/google/gms/google-services/3.1.1/google-services-3.1.1.pom'.
Could not GET 'https://jcenter.bintray.com/com/google/gms/google-services/3.1.1/google-services-3.1.1.pom'.
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.3'
// 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
}
SCREENSHOTS
SCREENSHOTS1
SCREENSHOTS2
SCREENSHOTS3
SCREENSHOTS4
SCREENSHOTS5

Gradle Build does not include Android Annotations Class

I am using Android Annotations for my Android project. I receive during startup of my App at my device the following exception
12-25 15:23:21.325: E/AndroidRuntime(24714): java.lang.RuntimeException:
Unable to instantiate activity
ComponentInfo{de.myproject.android/de.myproject.android.activity.MainActivity_}:
java.lang.ClassNotFoundException: Didn't find class "de.myproject.android.activity.MainActivity_"
on path: DexPathList[[zip file "/data/app/de.myproject.android-56.apk"],
nativeLibraryDirectories=[/data/app-lib/de.myproject.android-56, /vendor/lib, /system/lib]]
It seems to be that the generated Android Annotations Classes (MainActivity_) are not included in the apk file.
I am using the following Gradle build file
buildscript {
repositories {
jcenter()
mavenLocal();
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'com.google.gms:google-services:3.0.0'
classpath 'com.android.tools.build:gradle:2.2.3'
}
}
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25"
defaultConfig {
minSdkVersion 16
targetSdkVersion 20
multiDexEnabled true
}
lintOptions {
abortOnError false
}
testOptions.unitTests.all {
testLogging {
events 'passed', 'skipped', 'failed', 'standardOut', 'standardError'
}
}
}
repositories {
jcenter()
mavenLocal()
maven {
url "https://jitpack.io"
}
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
compile 'com.firebaseui:firebase-ui-auth:1.0.1'
compile group: 'org.androidannotations', name: 'androidannotations', version: '4.1.0'
compile group: 'org.androidannotations', name: 'androidannotations-api', version: '4.1.0'
compile 'com.google.android.gms:play-services-location:10.0.0'
compile ('de.myproejct:myApi:v1-1.22.0-SNAPSHOT') {
exclude group: 'org.apache.httpcomponents', module: 'httpclient'
exclude group: 'com.google.code.findbugs'
}
compile ('com.google.api-client:google-api-client-android:1.22.0') {
exclude group: 'org.apache.httpcomponents', module: 'httpclient'
exclude group: 'com.google.code.findbugs'
}
compile 'net.steamcrafted:load-toast:1.0.10'
testCompile 'junit:junit:4.12'
}
The error occured for the first time when I added the following dependency
compile 'net.steamcrafted:load-toast:1.0.10'
to my build file. When I remove this dependency my app works perfect on my device.
So what is wrong with my build file or with Android Annotations?
You should use the AndroidAnnotations depency in annotationProcessor scope.