Glympse SDK for Android with Android Studio - glympse

According to the step-by-step guide from https://developer.glympse.com/sdk/android, Glympse SDK uses Eclipse, but Android Studio is now the suggested IDE.
Can I use Android Studio for Glympse SDK? Was there any known issue for using Android Studio with Glympse SDK?

We're working on this for future releases. For now you can:
Copy the code below into GlympseApiLite/build.gradle
Add the following two lines to your main settings.gradle file and update the second line with the location of the GlympseApiLite directory
include ':GlympseApiLite'
project(':GlympseApiLite').projectDir = new File('../GlympseApiLite')
Enjoy Android Studio!
apply plugin: 'android-library'
android {
compileSdkVersion 21
buildToolsVersion '20'
defaultConfig {
minSdkVersion 5
targetSdkVersion 21
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
}
}
dependencies {
compile 'com.android.support:support-v4:21.+'
compile fileTree(dir: 'libs', include: ['Glympse*.jar'])
}

Related

Issue with bundling Android Wear1 app's with android gradle plugin 3.0.1

I cannot get the Wear1 signed APK into the res/raw folder of my signed mobile apk file since using the latest android gradle plugin 3.0.1
I have to use the latest gradle to get the google repo for certain dependencies.
I have checked the wear apk and it is signed with my production signature.
I know the preferred method going forward is to unbundle and I can successfully do that but Google's acknowledged latency issue on installing Wear 1 apps that way makes it unattractive at this time.
Below are my gradle files.
Project build.config
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
Mobile build.config
apply plugin: 'com.android.application'
apply from: rootProject.file('shared-config/android-signing.gradle')
android {
compileSdkVersion 27
buildToolsVersion '27.0.2'
defaultConfig {
applicationId "com.me.myapp"
minSdkVersion 18
targetSdkVersion 27
versionCode 1
versionName "1.0"
}
buildTypes {
debug {
signingConfig signingConfigs.debug
}
release {
signingConfig signingConfigs.release
}
}
flavorDimensions "environment"
productFlavors {
development {
dimension "environment"
}
production {
dimension "environment"
}
}
}
configurations {
developmentReleaseWearApp
productionReleaseWearApp
}
dependencies {
implementation 'com.google.android.gms:play-services-wearable:11.8.0'
implementation 'com.android.support:support-compat:27.1.0'
implementation 'com.android.support:percent:27.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
developmentReleaseWearApp project(path: ':wear', configuration: 'wear1Release')
productionReleaseWearApp project(path: ':wear', configuration: 'wear1Release')
implementation 'com.android.support:support-annotations:27.1.0'
implementation 'com.android.support:appcompat-v7:27.1.0'
implementation 'com.android.support:recyclerview-v7:27.1.0'
implementation 'com.android.support:preference-v14:27.1.0'
implementation 'com.android.support:design:27.1.0'
implementation 'com.android.support:support-v13:27.1.0'
provided 'com.google.android.wearable:wearable:2.2.0'
implementation 'com.google.android.support:wearable:2.2.0'
}
Wear build.config
apply plugin: 'com.android.application'
apply from: rootProject.file('shared-config/android-signing.gradle')
android {
compileSdkVersion 27
buildToolsVersion '27.0.2'
publishNonDefault true
defaultConfig {
applicationId "com.me.myapp"
minSdkVersion 23
targetSdkVersion 27
versionCode 2
versionName "1.0"
}
buildTypes {
debug {
signingConfig signingConfigs.debug
}
release {
signingConfig signingConfigs.release
}
}
flavorDimensions "wearVersion"
productFlavors {
wear1 {
dimension "wearVersion"
// Use the defaultConfig value
}
wear2 {
dimension "wearVersion"
minSdkVersion 24
}
}
configurations {
wear1Release
wear2Release
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "com.google.android.gms:play-services-wearable:11.8.0"
implementation "com.android.support:support-compat:27.1.0"
implementation "com.android.support:support-annotations:27.1.0"
implementation "com.android.support:appcompat-v7:27.1.0"
implementation "com.android.support:recyclerview-v7:27.1.0"
implementation "com.android.support:percent:27.1.0"
implementation "com.android.support:support-v4:27.1.0"
implementation "com.android.support:wear:27.1.0"
implementation "com.google.android.support:wearable:2.2.0"
implementation "com.android.support.constraint:constraint-layout:1.1.0-beta5"
provided 'com.google.android.wearable:wearable:2.2.0'
}
settings.gradle
include ':mobile'
include ':wear'
gradle-wrapper.properties
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
I was having the same problem this week. Today I finally managed to get the wear app correctly embedded into the mobile app APK using the 3.0.1 gradle. I added a productFlavor to my wear app build.gradle to match the productFlavor of the mobile app that I was generating the build for. Trying to specify a differently-named wear app configuration in the mobile app's build.gradle dependency list seemed to be the problem for me.
I would suggest trying to add development and production flavors to your wear app build.gradle:
development {
dimension "wearVersion"
// Use the defaultConfig value
}
production {
dimension "wearVersion"
// Use the defaultConfig value
}
and then change your mobile app build.gradle dependency to simply:
wearApp project(path: ':wear')
When you generate the build, it should match productFlavor to productFlavor by default and that is working for me.

Android Studio: Library not recognizing the Android API

I am trying to add this library to my project. I put the files from GitHub in my libraries directory under my project's default module folder.
When I first added the library, it wasn't recognized in my project until I changed the the folder structure from httpzoid/src/ to httpzoid/src/main/java.
At this point I am able to import classes from the library. The only problem is, Android components such as android.content.Context aren't recognized by the library, so it basically doesn't work.
The project does not have a Ant or Gradle build file so need to create one.
First you will need to delete the local.properties since it references the developers local sdk directory. Then create a file named build.gradle in the projects directory with the following content.
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.10.+'
}
}
allprojects {
repositories {
mavenCentral()
}
}
apply plugin: 'android-library'
android {
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
res.srcDirs = ['res']
}
}
compileSdkVersion 19
buildToolsVersion "19.0.3"
lintOptions {
abortOnError false
}
defaultConfig {
minSdkVersion 7
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
}
dependencies {
compile 'com.google.code.gson:gson:2.2.4'
}
Then in command line go to the projects root directory and run "gradle build". This will generate the file "Httpzoid.aar" in the projects build/libs directory. Copy this file into your main project's libs folder.
You'll now be able to add it as a dependency by modifying your project's build.gradle file and adding the following:
dependencies {
repositories {
flatDir {
dirs 'libs'
}
}
compile(name:'Httpzoid', ext:'aar')
}
As an aside, have you considered using Retrofit or Ion as an alternative REST client? These two excellent libraries have similar callback mechanisms and both are actively updated (Last update for HttpZoid was July 22, 2013). Also they are both on Maven Central.

Android Studio : Duplicate files error with Gradle

I have an error when I want to add Robospice library; this is my build.gradle file:
apply plugin: 'android'
android {
// Check on it to know witch Android API level is necessary:
// http://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels
compileSdkVersion 19
buildToolsVersion '19.0.1'
defaultConfig {
minSdkVersion 14
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile "com.android.support:support-v4:18.0.+"
compile "com.android.support:appcompat-v7:18.0.+"
compile "com.octo.android.robospice:robospice:1.4.11"
}
But unfortunately, Gradle gives me this error:
duplicate files during packaging of APK D:\blablabla\build\apk\mtc-debug-unaligned.apk
Execution failed for task ':mtc:packageDebug'.
Duplicate files copied in APK META-INF/LICENSE.txt
File 1: C:\Users\Anthony.gradle\caches\modules-2\files-2.1\org.apache.commons\commons-lang3\3.2.1\66f13681add50ca9e4546ffabafaaac7645db3cf\commons-lang3-3.2.1.jar
File 2: C:\Users\Anthony.gradle\caches\modules-2\files-2.1\org.apache.commons\commons-lang3\3.2.1\66f13681add50ca9e4546ffabafaaac7645db3cf\commons-lang3-3.2.1.jar
Thanks for your help !
Anthony
uses this code to solve your problem:
android{
packagingOptions {
exclude 'META-INF/LICENSE'
}
}
but if the problem remains, you must look for the file you need ignorie during generation of apk.and add to packagingOptions like in the code above

Android Gradle Build Resource.getIdentifier() always returns 0

I'm getting started on porting my Game over to the new Gradle Build system for Android.
I'm using the Resource.getIdentifier() method to load some resources by name instead of ID. However, ever since switching to the Gradle build, this call always returns 0. The assets are included in the built jar, and the R.class in the dex file contains all of my resources and ID's as expected, so I am at a loss as to explain this. This code worked before I changed to the gradle build. My build.gradle is below:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.7.+'
}
}
apply plugin: 'android'
dependencies {
compile 'com.android.support:support-v4:18.0.+'
}
android {
compileSdkVersion 18
buildToolsVersion "19"
defaultConfig {
minSdkVersion 10
targetSdkVersion 18
}
buildTypes {
debug {
packageNameSuffix ".debug"
}
release {
runProguard true
proguardFile getDefaultProguardFile('proguard-android.txt')
}
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
instrumentTest.setRoot('tests')
}
}
TIA.
D'oh! my problem was that Resources.getIdentifer() takes 3 parameters, one of which is the package name. The debug section of my gradle script was tacking on ".debug" to the package name on the device. Solution is to remove the .debug suffix in the build.gradle.

"Neither path nor baseDir may be null or empty string." error when importing gradle project in Android Studio 0.2.9

NOTE: i can't post links, so i guess you'll need to go here to follow the references. sorry, not my rule.
i'm getting the following error when attempting to import a project into Android Studio 0.2.9:
Could not execute build using Gradle distribution
'http://services.gradle.org/distributions-snapshots/
gradle-1.8-20130830160653+0000-bin.zip'.
A problem occurred configuring project ':library'.
A problem occurred configuring project ':library'.
Failed to notify project evaluation listener.
Neither path nor baseDir may be null or empty
string. path='' basedir='<projects folder>/
drag-sort-listview/library'
Consult IDE log for more details (Help | Show Log)
the project was originally a Maven project (1). i opened it in Eclipse ADT, generated a /librabry/build.gradle file per the instructions at (2).
the Eclipse ADT generated build.gradle looked like:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.4'
}
}
apply plugin: 'android-library'
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
}
android {
compileSdkVersion 7
buildToolsVersion "17.0.0"
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['']
resources.srcDirs = ['']
aidl.srcDirs = ['']
renderscript.srcDirs = ['']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
instrumentTest.setRoot('tests')
}
}
i had to change line 6 from
classpath 'com.android.tools.build:gradle:0.4'
to
classpath 'com.android.tools.build:gradle:0.5+'
to get Android Studio to stop saying the versions were miss-matched. i also added a /settings.gradle file containing
include ':library'
and a /local.properties file with the contents
# This file is automatically generated by Android Studio.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must *NOT* be checked into Version Control Systems,
# as it contains information specific to your local configuration.
# Location of the SDK. This is only used by Gradle.
# For customization when using a Version Control System, please read the
# header note.
sdk.dir=/Applications/Android Studio.app/sdk
i then attempted to import the /settings.gradle file by selecting it in the 'File | Import Project...' dialog. i have 'Use Auto-import' checked and 'Use gradle wrapper with verification' option selected in the dialog (3). the full idea.log entry can be viewed at (4).
any help would be greatly appreciated, thanks.
This will happen if you are using Environment Variables like so:
android {
signingConfigs {
release {
storeFile file(RELEASE_STORE_FILE)
storePassword RELEASE_STORE_PASSWORD
keyAlias RELEASE_KEY_ALIAS
keyPassword RELEASE_KEY_PASSWORD
}
}
And you have not defined those variables in your gradle.properties file located at the root of your project.
To fix this, make sure your variables are defined, here is an example from my gradle.properties file:
RELEASE_STORE_FILE=app_keystore.jks
RELEASE_STORE_PASSWORD=password
RELEASE_KEY_ALIAS=MyAppKey
RELEASE_KEY_PASSWORD=password
The error may be referring to your keystore's path. If the keystore's path doesn't work, it will think it's null. If you just want to use your keystore's file name (instead of the full path), make sure the keystore is in the root directory of your project.
android {
signingConfigs {
release {
storeFile file(**DoubleCheckPath**)
storePassword RELEASE_STORE_PASSWORD
keyAlias RELEASE_KEY_ALIAS
keyPassword RELEASE_KEY_PASSWORD
}
}
(Answered by the OP in a question edit. Converted to a community wiki answer. See Question with no answers, but issue solved in the comments (or extended in chat) )
The OP wrote:
ok, solved it. the issue is with the empty lists under android.sourceSets in build.gradle, I commented them out to resolve the error. Here's my current build.gradle:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.4'
}
}
apply plugin: 'android-library'
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
}
android {
compileSdkVersion 7
buildToolsVersion "17.0.0"
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
// java.srcDirs = ['']
// resources.srcDirs = ['']
// aidl.srcDirs = ['']
// renderscript.srcDirs = ['']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
instrumentTest.setRoot('tests')
}
}
hope that helps y'all.
you may miss a file in project, for "gradle.properties" file, because this file is include some varies, for example , our custom var, such key.storefile key.keypassword, you should check this file is exists or not.
Modify file(String.valueOf(RELEASE_STORE_FILE)) in
android {
signingConfigs {
release {
storeFile file(RELEASE_STORE_FILE)
storePassword RELEASE_STORE_PASSWORD
keyAlias RELEASE_KEY_ALIAS
keyPassword RELEASE_KEY_PASSWORD
}
}

Resources