Adding google analitycs to an android (gradle) project - android

My /build.gradle file:
....
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:support-v4:21.0.0-rc1'
compile 'com.google.apis:google-api-services-analytics:v3-rev99-1.19.0'
}
And a source file:
import com.google.analytics.tracking.android.EasyTracker
where analitics is highlighted in red. Why isn't it found?

Try with the following instead:
compile 'com.google.android.gms:play-services:5.0.77'
Assuming you are trying to use V4. See
https://developers.google.com/analytics/devguides/collection/android/v4/
Follow Before you begin section.

Related

how can I use this library in android studio

I don't know how to add this library to my project.
https://github.com/alamkanak/Android-Week-View
thank you.
Edit : can anyone explain how to open the sample app as an android project?
https://github.com/alamkanak/Android-Week-View/tree/develop/sample
In your build.gradle(app:module) add this line in the dependencies block:
implementation 'com.github.alamkanak:android-week-view:1.2.6'
and follow instruction according to the link you posted.
On your file gradle insert into dependencies paste this compile 'com.github.alamkanak:android-week-view:1.2.6'
Example:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:26.0.2'
compile 'com.android.support:design:26.+'
compile 'com.github.alamkanak:android-week-view:1.2.6'
}
Then click sync now.
Add this line inside module build.gradle file
compile "com.github.alamkanak:android-week-view:1.2.6"
Now sync gradle file and library will be added into project now you can follow instructions on github about calendar customization and settings

Android Studio Rendering Problems: android.support.design.widget.TabLayout class not found

When I add TabLayout inside my xml file it shows this error.
I also have these dependencies.
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.0.0'
compile 'com.android.support:support-v4:24.0.0'
}
See Code here
Add this dependency in gradle
compile 'com.android.support:design:23.1.0'
You can try to build it or change preview Android version in here Preview Android Version

Cannot find symbol HttpPost in android studio

I am using android studio, while trying to use HttpPost,HttpClient it says cannot find symbol. i surfed on internet and found that if we are at api level 23 we need to add some dependence so i added.
useLibrary 'org.apache.http.legacy'
and
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support:design:23.0.1'
compile 'org.apache.httpcomponents:httpcore:4.4.1'
compile 'org.apache.httpcomponents:httpclient:4.5'
}
in my build.gradle file. but even after adding this the same problem exist.
any other solution.
If you are having problem with dependency then download the jar from the following link and add it to your libs folder. Then right click on that jar then select Add as Library.
https://hc.apache.org/downloads.cgi

How can I use appcompat-v7:19.1 in Android Studio

Android Studio 1.3 generate a build.gradle
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.0'
}
but I want use com.android.support:appcompat-v7:19.1, when I type this, it tips Failed to resolve: com.android.support:appcompat-v7:19.1
How can I use appcompat-v7 with lower version ?
Add the dependency to {project}/build.gradle
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:19.1.+'
}
Click the Sync Project with Gradle Files button.
I hope it helps you.
For more info please visit:
https://developer.android.com/tools/support-library/features.html
Try using:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:19.1.+'
}
Also ensure that you have those libraries installed.

How to fix duplicate libraries - more than one library with package name 'android.support.v7.appcompat'

Gradle build error - more than one library with package name android.support.v7.appcompat. This project has Chrome Cast in it, so is using android-support-v7-appcompat and CastCompanionLibary-android-master. Project structure is the following:
BaseGameUtils
CastCompanionLibrary-android-master
VideoBrowserActivity
android-support-v7-appcompat
android-support-v7-mediarouter
google-play-services_lib
Really tough error because the compiler doesn't give much information other than 'more than one library with package name 'android.support.v7.appcompat'. Understand why you don't want to be using different versions of the same library, but why doesn't the compiler reveal what versions are being used, and where they are being called from?
Trying to add leaderboard similar to type-a-number challenge (github example project)
There are a total of (7) build.gradle files. One for the top level and one for each of the packages listed above. Top level gradle file:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0'
}
BaseGameUtils:
dependencies {
compile 'com.android.support:appcompat-v7:20.0.+'
compile 'com.android.support:support-v4:20.0.+'
compile 'com.google.android.gms:play-services-games:6.5+'
compile 'com.google.android.gms:play-services-plus:6.5+'
compile 'com.google.android.gms:play-services-appstate:6.5+'
}
CastCompanionLibrary-android-master
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
compile 'com.android.support:appcompat-v7:20.0.+'
compile project(':android-support-v7-mediarouter')
compile 'com.google.android.gms:play-services-cast:6.5+'
compile project(':BaseGameUtils')
}
VideoBrowserActivity
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
compile project(':CastCompanionLibrary-android-master')
}
android-support-v7-appcompat
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
}
android-support-v7-mediarouter
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
compile project(':android-support-v7-appcompat')
}
google-play-services_lib
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
}
Any help is appreciated on this.
Just go through you project's libs folder not from the Android Studio but from you windows explorer/finder (for windows)/(for mac). And search for android.support.v7.appcompat. Any evidence found related to Apcompat (whether it is v4 or v7) is recommended to be deleted.
Hopefully your problem will be solved.
In your libs folder dont miss any sub directory that has libs folder.
Follow the Steps
1) Remove This repository:
implementation 'com.android.support:appcompat-v7:28.0.0'
2) Add This Repository
implementation 'com.android.support:support-v4:21.0.3'
compile group: 'com.android.support', name: 'appcompat-v7', version: '26.0.1'
3) That's It You Are Ready To Go

Categories

Resources