ShowcaseView is contained in a Zip file here. But what exactly am I downloading and how do I import it in Eclipse?
After 2 days I succeed, I have created steps to import ShowcaseView in Eclipse that may be helpful to you.
How to use Showcase View in Eclipse.
Download ShowcaseView from github and extract.
Now Follow step for import.
- Right click on Project Explorer
- Import -> Android -> Existing Android Code Into Workspace
- Select Extracted "ShowcaseView-master"
- Check both project "library" and "MainActivity"
- Check "Copy projects into workspace"
- Finish.
(After importing you can see 2 projects imported namely "main" and "SampleActivity", you may change "main" as "libShowcaseView" and "SampleActivity" as "ShowcaseViewDemo" so you can easily identify. :) )
May you see error in "ShowcaseViewDemo" (Dont worry...), See src/ folder is also blank (in both "libShowcaseView" and "ShowcaseViewDemo") :) right??? Dont mind.
Make following packages in "libShowcaseView" project. See Example.
- com.github.amlcurran.showcaseview
- com.github.amlcurran.showcaseview.targets
and Move all java files from /java/com/github/amlcurran/showcaseview and /java/com/github/amlcurran/showcaseview/targets Respectively.
Make following packages in "ShowcaseViewDemo" project. See Example.
- com.github.amlcurran.showcaseview.sample
- com.github.amlcurran.showcaseview.sample.animations
- com.github.amlcurran.showcaseview.sample.legacy
- com.github.amlcurran.showcaseview.sample.v14
and move files as above (from java folder respectively).
Now right click on "libShowcaseView" project->properties->Android->Move down and check "Is Library" then add "actionbarsherlock" as Library. See Preview
Now Add as library in ShowcaseViewDemo. Goto properties of "ShowcaseViewDemo"->Android->Add->select "libShowcaseView"->Ok...
I think you didn't ran into error now. You can Run.
You can ping any time for any suggestion or help.
Happy ShowcaseViewing...
Easiest way is:
Create an empty Android Application project in your Eclipse workspace.
Copy files in ShowcaseView/library/ folder of github to your new project base folder.
Refresh project in Eclipse.
Goto project properties - Android and select "Is Library"
Clean unnecessary stuff and build.
It should be ready to add as dependency of your app.
Alternatively you can pick another library project .project file and copy it inside this library folder, edit it to match your new project name, etc... And then import in Eclipse. But this is more hardcore if you don't know what you're doing.
Soure : How do I build these libraries from GitHub
Following ツ Pratik Butani ツ's Answer and use Android Support Library to replace ActionBarSherlock
In project.properties of libShowcaseView and ShowcaseViewDemo
add target=android-21
Right click on "libShowcaseView" Properties->Android->Library->Add... select AppCompat(android support library v7)->Ok
In styles.xml of ShowcaseViewDemo
Change
android:Theme.Holo.Light, Theme.Sherlock.Light, Theme.Sherlock.Light.DarkActionBar to Theme.AppCompat
Remove <item name="android:fontFamily">sans-serif-light</item> in ListItemBigText
In ActionItemsSampleActivity.java
change SherlockActivity to ActionBarActivity, getSupportMenuInflater to getMenuInflater.
In MultipleActionItemsSampleActivity.java
change SherlockActivity to ActionBarActivity
change com.actionbarsherlock.app.ActionBar.OnNavigationListener to android.support.v7.app.ActionBar.OnNavigationListener
changegetSupportMenuInflater to getMenuInflater
Do it in there steps:
Download ShowcaseView from github`
Create package com.github.amlcurran.schowcaseview and com.github.amlcurran.schowcaseview.targets in your eclipse project.
Extract ShowcaseView-master.zip or rar.
Go to library/src/main/java/ and copy com/github/amlcurran/showcaseview java files in com.github.amlcurran.schowcaseview package.
Do same thing for com/github/amlcurran/showcaseview/targets in com.github.amlcurran.schowcaseview.targets.
Finally, copy others files in differents folder drawables, layouts, value(copy in the old value files, style.xml for example).
Related
I'm trying to use this library called OpenSimplexNoise, made by GitHub user TheCodingTrain. But I immediately discovered that I couldn't use it.
I did some digging to try to figure this out on my own, and I discovered that the JAR file and the main folder should have the same name (for example, the library file would be named OpenSimplexName and the JAR file would be OpenSimplexNoise.jar), and the folder the JAR file is in should be called "library." Once I fixed these issues, OpenSimplexNoise appeared in the "Import Library" menu in the "Contributed" section. But once I clicked it, a bunch of code appears:
import japplemenubar.*;
import processing.awt.*;
import processing.core.*;
import processing.data.*;
import processing.event.*;
import processing.javafx.*;
import processing.opengl.*;
along with the error message:
More than one library is competing for this sketch.
The import japplemenubar points to multiple libraries:
core (C:\Program Files\Processing\processing.3.5.4\core)
OpenSimplexNoise (C:\Users**\Documents\Processing\libraries\OpenSimplexNoise).
Extra libraries need to be removed before this sketch can be used."
I tried removing japplemenubar, but the same issue appeared with processing.awt, so I tried removing that, but it just kept happening with each different import. I tried deleting it all and just typing "import processing.OpenSimplexNoise.*;", but it said "The import processing.OpenSimplesNoise cannot be resolved."
Does this mean that I'm just doing something wrong, or is this library no longer usable?
I recommend watching/following the videos linked in the README and understanding those:
https://youtu.be/pI2gvl9sdtE
https://youtu.be/U0TGZCEWn8g
The tutorials are how to put organize/compile a basic Processing library from scratch, not how to use library itself.
It would've been easier if a distribution zip would have been uploaded, but the point is learn how to generate it.
Downloading the library zip and unzipping in Processing won't work.
You need to:
(install eclipse if you haven't done so already as part of the video tutorial)
clone / download the project on your computer
Import the project into eclipse:
Drag and drop the build.xml file into the Ant panel: (in my view I've got multiple Processing libraries, you might have just OpenSimplexNoise)
Press the green Play Icon to run the build.
Initially I ran into this error:
BUILD FAILED
/Users/George/Documents/eclipse/OpenSimplexNoise-for-Processing/resources/build.xml:107: The following error occurred while executing this line:
/Users/George/Documents/eclipse/OpenSimplexNoise-for-Processing/resources/build.xml:141: /Users/George/Desktop/OpenSimplexNoise-for-Processing/lib does not exist.
Instead of trying to debug/fix the xml file I simply made the folder structure it wanted: a desktop folder named OpenSimplexNoise-for-Processing containing a lib folder.
Smooth sailing after this: BUILD SUCCESSFUL
Part of the ant build is copying the library to Documents/Processing/libraries so you can simply run the examples from there:
FWIW I've uploaded the compiled library here.
If simply wanted to use noise in Processing the built-in noise() function would do the trick.
If you want Simplex Noise without compiling Daniel Shiffman's example library you could try toxiclibs and it's toxi.math.noise package (also comes with an example sketch).
I have this code in my java project, which reads a file and converts it into a string.
String txt = FileUtils.readFileToString(text);
It uses this class https://commons.apache.org/proper/commons-io/apidocs/org/apache/commons/io/FileUtils.html
How do I import this into my project?
Thanks :)
If you are using Ant as a build in tool then below solution works,
Step - 1: download .jar file from here,
Step - 2: Then after add it into your class path likewise,
Project right click -> properties
Step 3 : find Jar from you machine, and add it to your class path. likewise,
Click -> OK.
Now, Your problem has been resolved.
First of all you are looking for deprecated method. I suggest you should not use deprecated methods if possible.
Secondly, if you just want to get content of file in String, you can do it in following way with java.nio.file.Files and without using any third party library.
File file = new File("abc.txt");
String txt = new String(Files.readAllBytes(file.toPath()));
Include commons-io jar in build path of your project by downloading it from Apache site -
https://commons.apache.org/proper/commons-io/download_io.cgi
Try following what Rene said here:
Add commons-io dependency to gradle project in Android Studio
You can also try to drag the jar file under Jar folder of lib after downloading it, then right click on the Jar file and select the "Add as library" option. Then select your app from the dialog box.
Where is the R.java file in Android Studio? Can someone please help with this? I already tried google for the answer but can't find any solution.
Based on the new stable release of Android Studio (3.6) we have:
So, now to find your generated resource classes you need the following steps:
1) Open your project.
2) Go to your module build path.
3) Open the outputs/apk/debug/app-name-debug.apk file.
4) Choose your classes.dex file.
5) Look at the down placed area and go to your full package path.
6) You can see all bytecoded resource classes. So, scroll down to what you are looking for.
7) Expand the resource class you need to proceed (for example, let it be R.id)
8) Go to you id's.
That's it.
UPDATE:
If you would like to see actual id integer number you should follows steps below:
1) By (7) Go to the resource class you need to proceed and right click to show the context menu
2) Choose "Show Bytecode" to see the flexible dialog "DEX Byte Code for R$id", for example, for id class
3) Scroll down to the actual id to look its number
Although the current Android Gradle Plugin doesn't generate a R.java anymore you can still inspect the corresponding class file (see Sergey V.`s answer).
However, if you (like probably in most cases) just want to look up the generated IDs for your resources, there is an easier way:
In the project pane on the left hand side switch from Android to Project view using the drop-down at the top. Then navigate to app/build/intermediates/runtime_symbol_list/<insert build type here>/R.txt. This file lists all IDs generated by AGP during the build process.
I use Android Studio 3.3.2
\app\build\generated\not_namespaced_r_class_sources\debug\processDebugResources\r\android\support\constraint\R.java
As noted above, "The new Android Gradle Plugin generates the corresponding bytecode directly and does not make the intermediate R.java file".
Using the ubuntudroid solution you can find an id also this way. Find R.txt and copy absolute path. Project > app > build > intermediates > runtime_symbol_list > debug > R.txt. Then right click and select Copy Path..., 1. Absolute Path Ctrl+Shift+C.
This way you will obtain a path to R.txt, for instance, "C:\Users\user\AndroidStudioProjects\your_project\app\build\intermediates\runtime_symbol_list\debug\R.txt". Copy the path without R.txt to a text file for future references, for example, with Notepad++.
Press Ctrl+Shift+F to find in directory. Insert an id and the path.
== Old answer ==
Change a project view from Android to Project or Project Files. Find one of these two files.
Then you can revert back to Android view.
I use Android Studio 2.3.3. The R.java file is shown in the picture above.
In the left upper side, there is a select list. Select the [project] option so that you can see all the folders and files.
R.java is the generated file by ADT or Android studio. It will be located under app\build\generated\source\r directory.
./app/build/generated/source/r/debug/android/support/v7/appcompat/R.java
./app/build/generated/source/r/debug/your/packagename/name/R.java
I am using Android Studio 2.2.3 , the R.java file is shown in the picture below.
Goto in the left upper side there is a selecting list ,
select [package]
Open "App Folder"
com.example.saeedanwar.myapplication;
r
In my project in Android Studio 4.1
R.jar that you can actually unzip resides in app build folder, as follows:
jar -xf R.jar
Once the jar is unpacked you can find R.java inside of app package:
If you're using Mac or Linux, try the following command line on your terminal:
find . -name "R.*"
It will print something like:
./app/build/intermediaries/runtime_symbol_list/debug/R.txt
./app/build/intermediaries/compile_and_runtime_not_namespaced_r_class_jar/debug/R.jar
It is inside app\build\generated\source\r folder
Project/app/build/generated/source/r/debug/com.android.'projectname'/R.java
--The R.Java that contains your xml layouts and views id's in Android Studio 3.5.3 -- Project/app/build/generated/not_namespaced_r_class_sources/debug/r/com/"your package"/R.java
This answer will be in a constant state of flux until Android standardize a method of matching their annoying decimal/hexadecimal id references to a tangible resource such as my_layout.xml.
For Android Studio Dolphin | 2021.3.1 Patch 1 have a look at this file:
/project/package/build/intermediates/stable_resource_ids_file/debug/stableIds.txt
It is produced by RUN (not just BUILD). Sample:
layout/mtrl_picker_header_fullscreen = 0x7f0d00de
string/cancel = 0x7f1101f0
style/ThemeOverlay.MaterialComponents.MaterialCalendar = 0x7f1202f3
id/gpxBtn = 0x7f0a0346
We're creating a new project in IntelliJ and must have something wrong because when we right click on a directory, select New and then get the context menu, Java based options are not shown. Currently get things like File, some HTML options, XML options.
We have assumed so far it's something we haven't configured correctly in the Project/Module configuration. The new module we are talking about is part of a multi module project. We created it using a Maven web archetype.
Any help configuring the project nature?
Edit: The answer is basic: 'That moment when you realise somethings not working because you haven't been clicking 'Apply'... :) We had a good laugh at ourselves when we discovered this'
The directory or one of the parent directories must be marked as Source Root (In this case, it appears in blue).
If this is not the case, right click your root source directory -> Mark As -> Source Root.
This can also happen if your package name is invalid.
For example, if your "package" is com.my-company (which is not a valid Java package name due to the dash), IntelliJ will prevent you from creating a Java Class in that package.
you need to mark your directory as source root (right click on the parent directory)
and then compile the plugin (it is important )
as result you will be able to add classes and more
If you open your module settings (F4) you can nominate which paths contain 'source'. Intellij will then mark these directories in blue and allow you to add classes etc.
In a similar fashion you can highlight test directories for unit tests.
Project Structure->Modules->{Your Module}->Sources->{Click the folder named java in src/main}->click the blue button which img is a blue folder,then you should see the right box contains new item(Source Folders).All be done;
I will share another interesting point. If you try to create a package with the reserved keyword then it will be treated as a normal directory and not a package. I was having this issue where I was creating a package named import and it was converting that to a directory.
Another possible solution is that the project name is not acceptable. For example, creating a project with spaces in the name does not block the project creation but the proper sources are not marked and when those are marked manually, I still was unable to create classes. Recreating the project with hyphens (-) instead of spaces corrected the problem for me.
Make sure you are not creating a package name which is same as predefined keywords in java like enum, int, long etc.
In my case I was trying to create a class under "enum" package. As soon as I changed package name to "enums" I was able to create class in it.
Had this issue too. Invalidating Caches/Restart did the trick for me. Please upvote so the the IntelliJ folks take this more seriously. This gives the IDE a terrible UI/UX experience.
https://youtrack.jetbrains.com/issue/IDEA-203100
There is another case where 'Java Class' don't show, maybe some reserved words exist in the package name, for example:
com.liuyong.package.case
com.liuyong.import.package
It's the same reason as #kuporific 's answer: the package name is invalid.
If you just created your project, let IntelliJ finish indexing your project.
You need to mark your java directory as Source Root ,
Right Click on Java directory
Select Mark Directory as option and click on the sub menu option Source Root
Most of the people already gave the answer but this one is just for making someone's life easier.
TL;DR
You must add the test folder as source.
Right click on java directory under test
Mark it as Tests
Add src/test/java in Test Source Folders
Thats it, IntelliJ will consider them as test source.
In the folder Libraries I added the folder that contains the jar file of epubcheck (http://code.google.com/p/epubcheck/). But for some reason it does not work.
I also added this line of code:
import com.adobe.epubcheck.api;
Am I missing something?
UPDATE
Even with all the jars in the Libraries folder... It still does not work.
Here is the instructions for adding lib to the code from epubchecker README:
USING AS A LIBRARY
You can also use EpubCheck as a library in your Java application.
EpubCheck public interfaces can be found in com.adobe.epubcheck.api
package. EpubCheck class can be used to instantiate a validation
engine. Use one of its constructors and then call validate() method.
Report is an interface that you can implement to get a list of the
errors and warnings reported by the validation engine (instead of the
error list being printed out).
OUTPUT
deps-jar:
Created dir: /Users/.../NetBeansProjects/epubValidation/build
Updating property file: /Users/.../NetBeansProjects/epubValidation/build/built-jar.properties
Created dir: /Users/.../NetBeansProjects/epubValidation/build/classes
Created dir: /Users/.../NetBeansProjects/epubValidation/build/empty
Created dir: /Users/.../NetBeansProjects/epubValidation/build/generated-sources/ap-source-output
Compiling 1 source file to /Users/.../NetBeansProjects/epubValidation/build/classes
/Users/.../NetBeansProjects/epubValidation/src/epubvalidation/EpubValidation.java:6: package com.adobe.epubcheck does not exist
import com.adobe.epubcheck.api;
1 error
/Users/.../NetBeansProjects/epubValidation/nbproject/build-impl.xml:915: The following error occurred while executing this line:
/Users/.../NetBeansProjects/epubValidation/nbproject/build-impl.xml:268: Compile failed; see the compiler error output for details.
BUILD FAILED (total time: 9 seconds)
Remove the /Users/... entry from your libraries. Adding a folder in the classpath doesn't add all the jars in that folder, it adds the folder as if it were a jar. It's trying to read that folder as if it contains the .class files, which is incorrect. Instead, select the external jars option and add all the jars in lib, much like how you probably added the epubcheck jar.
An alternative: use Maven. It will do all this library management for you, and Netbeans makes it pretty easy to use. Here's a tutorial.
You have already done the following:
a) Add the epubcheck jar to Libraries
right-click on Libraries & select "Add JAR/Folder...", navigate inside your directory
/Users/xxx/epubcheck-3.0b5-db & select epubcheck-3.0b5.jar
b) Add the entire epubcheck folder to Libraries
right-click on Libraries & select "Add JAR/Folder...", navigate to directory
/Users/xxx/epubcheck-3.0b5-db & select it
a) is correct
b) is incorrect - you should add each individual jar file within /Users/xxx/epubcheck-3.0b5-db/lib
To correct, do this within Netbeans:
c) Remove (b) as follows
right-click Libraries->/Users/xxx/epubcheck-3.0b5_db and select Remove.
d) Add batik-css-1.7.jar within epubcheck lib folder to Libraries
right-click on Libraries & select "Add JAR/Folder...", navigate to directory
/Users/xxx/epubcheck-3.0b5-db/lib & select batik-css-1.7.jar
e) repeat (d) for each of batik-util-1.7.jar, commons-compress-1.2.jar, jing-20120227.jar, sac-1.3.jar, saxon-9.1.0.8.jar
Alternative Solution
You could add all of /Users/xxx/epubcheck-3.0b5_db as a separate Netbeans project:
i) copy/move /Users/xxx/epubcheck-3.0b5_db to
netbeansWorkspaceFolder/epubcheck-3.0b5/epubcheck-3.0b5
ii) move epubcheck-3.0b5.jar to netbeansWorkspaceFolder/epubcheck-3.0b5/epubcheck-3.0b5/dist/epubcheck-3.0b5.jar
iii) add it as a Netbeans project:
Add Project -> Java -> Java with existing Sources -> Next ->
set project name=epubcheck-3.0b5 -> Browse -> select epubcheck-3.0b5 directory -> Next ->
for source package folder select "Add Folder..." and select "epubcheck-3.0b5/epubcheck-3.0b5" -> Next ->
Included files list should now show all required lib jars (lib/*.jar) -> Finish
iv) select epubValidation project -> Libraries folder & right-click & select "Add Project..." & select "epubcheck-3.0b5" project
v) Now dist/epubcheck-3.0b5.jar of the lib jars within epubcheck-3.0b5 are available to epubValidation
=B)
To import the epubcheck you need to do the following:
Create a new Java project... Unchecked Create Main Class, this is the only way to make it work.
Right click on Libraries to select Add JAR/Folder...
Add JAR...
Add the other JARs.
New File... New Class...
Make sure that the package input is empty.
Write the import...
There you go.
I am not really sure why you have to do it this way... But that is the only way I found to solve the problem.