I have built a kotlin multiplatform project using gradle from my home machine without any problems. However upon entering a corporate proxy that does not allow the downloading of executable files.
I keep getting the following...
**Execution failed for task ':kotlinNodeJsSetup'.
> Could not resolve all files for configuration ':detachedConfiguration1'.
> Could not resolve org.nodejs:node:14.15.4.
Required by:
project :
> Could not resolve org.nodejs:node:14.15.4.
> Could not get resource 'https://nodejs.org/dist/v14.15.4/node-v14.15.4-win-x64.zip'.
> Could not HEAD 'https://nodejs.org/dist/v14.15.4/node-v14.15.4-win-x64.zip'.**
There must be a way of defining an alternate location of baseUrl to download nodejs from.
I have a location within our company but I want to be able to tell gradle where that location should be.
I am trying add a .so files to a dlib libary in android studio. I have followed the following steps
Migrate from ndkCompile
If you're using the deprecated ndkCompile, you should migrate to using either CMake or ndk-build. Because ndkCompile generates an intermediate Android.mk file for you, migrating to ndk-build may be a simpler choice.
To migrate from ndkCompile to ndk-build, proceed as follows:
Compile your project with ndkCompile at least once by selecting Build > Make Project. This generates the Android.mk file for you.
Locate the auto-generated Android.mk file by navigating to project-root/module-root/build/intermediates/ndk/debug/Android.mk.
Relocate the Android.mk file to some other directory, such as the same directory as your module-level build.gradle file. This makes sure that Gradle doesn't delete the script file when running the clean task.
Open the Android.mk file and edit any paths in the script such that they are relative to the current location of the script file.
Link Gradle to the Android.mk file .
Disable ndkCompile by opening the build.properties file and removing the following line:
// Remove this line
android.useDeprecatedNdk = true
Apply your changes by clicking Sync Project in the toolbar.
However I am getting this error saying the project cant configure.
org.gradle.api.ProjectConfigurationException: A problem occurred configuring project ':dlib'.
at org.gradle.configuration.project.LifecycleProjectEvaluator.addConfigurationFailure(LifecycleProjectEvaluator.java:94)
at org.gradle.configuration.project.LifecycleProjectEvaluator.notifyAfterEvaluate(Li
Caused by: java.lang.NullPointerException
Any help much appreciated.
I have just started using Android Studio,
So forgive me if i am unable to explain the situation properly.
But i will try to update details as required.
In my gradle project i use JakeWarton DiskCache with nineoldandroids
Both as jar files added to the app/libs folder.
In addition there also a Library project from this location
https://android-arsenal.com/details/1/122
repositories {
maven {
url "https://jitpack.io"
}
}
dependencies {
compile 'com.github.flavienlaurent:datetimepicker:0f5d399995'
}
I use it by adding the repository and dependency as shown above.
When i try to run this project i get following error
Execution failed for task ':app:packageAllDebugClassesForMultiDex'.
java.util.zip.ZipException: duplicate entry: com/nineoldandroids/animation/Animator$AnimatorListener.class
I can understand that since my app has a copy of nineoldandroids.jar and the lib-project also needs it at compile time there is some kind of issue.
How can i fix this conflict?
The library com.github.flavienlaurent:datetimepicker:0f5d399995 is using the
nineoldandroids library as a maven dependency.
dependencies {
compile 'com.nineoldandroids:library:2.4.0'
//...
}
Check the original build.gradle file in github.
To solve your issue you have to:
remove the nineoldandroids.jar from your project
add the nineoldandroids library as maven dependency in your project
Use:
dependencies{
//
compile 'com.nineoldandroids:library:2.4.0'
}
When I build the Amazon (Kindle) flavor of my Android app I run into this Runtime error:
Caused by: java.lang.RuntimeException: Stub!
at com.amazon.device.messaging.ADMMessageReceiver.<init>()
I need the local amazon-device-messaging.jar file to compile my app, however I do not need to include it during runtime as the amazon device will have the necessary classes and methods.
How do I update my Android Studio build.gradle file to do this?
I also ran into this issue. When adding the Amazon Device Messaging jar as a library, Android Studio automatically generated
dependencies {
compile files('libs/amazon-device-messaging-1.0.1.jar')
}
I just needed to switch that to
dependencies {
provided files('libs/amazon-device-messaging-1.0.1.jar')
}
That did the trick for me. I'd up-vote your answer, #Clu, but I don't have a high enough reputation.
To solve this I used the provided type of dependency.
Inside my project modules build.gradle file, right before my dependencies closure I included the following:
configurations {
provided
}
sourceSets {
main {
compileClasspath += configurations.provided
}
}
And then, within my dependencies closure I included the following:
dependencies {
provided files('libs/amazon-device-messaging-1.0.1.jar')
}
This ensured that the .jar was only used for compile time and not runtime. I'm quite new to Android Studio, and this took me a while to figure out; hopefully this will help you make the switch to Android Studio as well.
Add the ADM jar in the Maven local repository.
Command :
mvn install:install-file "-Dfile=amazon-device-messaging-1.0.1.jar" "-DgroupId=com.amazon.device.messaging" "-DartifactId=amazondevicemessaging" "-Dversion=1.0.1" "-Dpackaging=jar"
Include local maven repository as project dependency :
Add “mavenLocal()” in main Gradle build script:
allprojects {
repositories {
mavenCentral()
mavenLocal()
}
Link the Maven artifact in ADM project.
Add below line ADMWrapperLib Gradle script (::).
provided 'com.amazon.device.messaging:amazondevicemessaging:1.0.1'
I'm trying to use the Parse library in Android Studio. I have used the basic example on their website and added the jar to the libs folder as well as added as a global library. Nothing seems to be working without errors:
Gradle: package com.parse does not exist
Gradle: package com.parse does not exist
Gradle: package com.parse does not exist
Gradle: cannot find symbol variable Parse
Gradle: cannot find symbol variable ParseAnalytics
Gradle: cannot find symbol class ParseObject
Gradle: cannot find symbol class ParseObject
Android Studio gives no errors in the code.
I encountered the same problem too and here's what I did:
I placed the entire Parse-1.2.5 in the libs folder (I didn't have to create the folder as Parse's quickstart said).
Open the build.grade file. There are two of them - open the one that's at the same level as the src folder
You'll see two instances of "dependencies". Add the following to the "dependencies" that is NOT nested under "buildscript":
compile files('libs/Parse-1.2.5/Parse-1.2.5.jar')
If that still doesn't work, try right clicking the Parse-1.2.5.jar file and select "Add to Project Library"
Hope that helps!
As of version 1.10.0 the Parse SDK is open source and available on Maven, so now you can just put this in gradle:
compile 'com.parse:parse-android:1.10.0'
Just replace 1.10.0 with whatever the newest verison is at the time you read this.
Alternatively, if you like living on the edge, you can tell gradle to auto-update:
compile 'com.parse:parse-android:1.+'
EDIT: On 1/28/16 Facebook announced that they are retiring the Parse service, so if you are starting a new project I would urge you to consider using a different service.
The problem is that gradle doesnt do a proper rebuild and somehow still reads a cached version of the old build script. Add the libs as per above reply then open a terminal and do a gradle clean. If you are running on windows (or any platform for that matter) I suggest you do a quick internet search on "intellij clean" to see what it does and then simply do a manual clean by deleting the appropriate folder. This should do the trick!
edit: before manually deleting the appropriate folders/caches you can also first try clicking on file -> invalidate caches. If this still doesnt work manually delete all the appropriate folders and caches
1) I unzip the folder into the libs folder:
YourProject/app/libs/Parse-1.9.2/ <<< here all the jar files.
2) and then in the dependencies section from your build.gradle, I set:
dependencies {
...
// Parse 1.9.2
compile 'com.parse.bolts:bolts-android:1.+'
compile fileTree(dir: 'libs/Parse-1.9.2', include: 'Parse-*.jar')
...
}
I set the specific folder where the jars are contained dir: 'libs/Parse-1.9.2'
Hope it helps!
In your app gradle add below code
dependencies {
compile 'com.parse.bolts:bolts-android:1.+'
compile 'com.parse:parse-android:1.+'
}
In AndroidManifest.xml file add below permission
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
In your Application class inside onCreate() method add below code
Parse.initialize(this, "application_id", "client_key");
ParseInstallation.getCurrentInstallation().saveInBackground();
then run. Hope this works, for more info https://parse.com/apps/quickstart#parse_data/mobile/android/native/existing
Place the contents of the Parse-1.. folder in to your libs directory ... not the Parse-1.. folder itself. That worked for me.
donwload parse SDK for android and follow instruction given on below mentioned link:
https://parse.com/apps/quickstart#parse_data/mobile/android/native/existing
Add the SDK to your app in Android Studio
Add the following to your build.gradle
dependencies {
compile 'com.parse.bolts:bolts-android:1.+'
compile 'com.parse:parse-android:1.+'
}
and then
Add the following to your Application#onCreate():
Parse.initialize(new Parse.Configuration.Builder(myContext)
.applicationId("YOUR_APP_ID")
.server("http://YOUR_PARSE_SERVER:1337/parse")
...
.build()
);
Your app must request the INTERNET and ACCESS_NETWORK_STATE permissions, if it isn't doing so already. Add the following lines inside the tag in your AndroidManifest.xml:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
Compile and run!
After installing the SDK, copy and paste this code into your app, for example in your Activity#onCreate():
ParseObject testObject = new ParseObject("TestObject");
testObject.put("foo", "bar");
testObject.saveInBackground();
You will also have to add an import statement at the top of your file:
import com.parse.ParseObject;
Run your app. A new object of class TestObject will be sent to the Parse Server and saved.
Unzip the Parse.zip file
Go to Android Studio. Change Android to Project (top left corner).
Expand the folders and find "libs".
Copy the "parse" folder and paste it in the "libs".
Now, under the "src" open build.gradle
Paste the following under dependencies-
compile files('libs/Parse-1.9.4/Parse-1.9.4.jar')
compile files('libs/Parse-1.9.4/bolts-android-1.2.0.jar')
(give your Parse version name)
Done. You gotta ready to go!!