Aix build success but not downloading.
Execution Log:
Started Compiling Project TextExtractor
Buildfile: /compiler/androidX/build.xml
javac:
[mkdir] Created dir: /compiler/androidX/build/BfCAf/classes
[javac] Compiling 1 source file to /compiler/androidX/build/BfCAf/classes
[javac] warning: [options] bootstrap class path not set in conjunction with -source 1.7
[javac] Note: Wrote file file:/compiler/androidX/build/BfCAf/classes/simple_components.json
[javac] Note: Wrote file file:/compiler/androidX/build/BfCAf/classes/simple_components.txt
[javac] Note: Wrote file file:/compiler/androidX/build/BfCAf/classes/simple_components_build_info.json
[javac] Note: Wrote file file:/compiler/androidX/build/BfCAf/classes/AutogeneratedOdeMessages.java
[javac] Note: Wrote file file:/compiler/androidX/build/BfCAf/classes/ComponentsTranslation.java
process:
[mkdir] Created dir: /compiler/androidX/out/BfCAf
[mkdir] Created dir: /compiler/androidX/build/BfCAf/externalComponents
[mkdir] Created dir: /compiler/androidX/build/BfCAf/externalComponents-classes
[java]
[java] Extensions : Generating extensions
unjarAllExtensionLibraries:
jarAllExtensions:
dexAllExtensions:
extensions:
BUILD SUCCESSFUL
Total time: 1 second
the code:
package com.mycompany.textanalyser;
import android.util.Log;
import com.google.appinventor.components.annotations.SimpleFunction;
import com.google.appinventor.components.annotations.SimpleObject;
import com.google.appinventor.components.runtime.AndroidNonvisibleComponent;
import com.google.appinventor.components.runtime.ComponentContainer;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* An App Inventor extension to extract specific patterns (emails, numbers, hyperlinks)
* from a text or HTML string using regular expressions.
* This extension is not visible.
*/
@SimpleObject(external=true) // Retrait de l’argument ‘description’ pour compatibilité de compilation
public class TextExtractor extends AndroidNonvisibleComponent {
private static final String LOG_TAG = "TextExtractorExtension";
// Regular Expression Constants (Regex)
// Regex for email addresses (simple but effective)
private static final String EMAIL_REGEX = "\\\\b\[A-Za-z0-9.\_%+-\]+@\[A-Za-z0-9.-\]+\\\\.\[A-Za-z\]{2,}\\\\b";
// Regex for whole or decimal numbers (including simple scientific notation)
private static final String NUMBER_REGEX = "\[-+\]?\\\\b\\\\d+(\\\\.\\\\d+)?(\[eE\]\[-+\]?\\\\d+)?\\\\b";
// Regex for hyperlinks (URLs starting with http or https)
private static final String URL_REGEX = "https?://\[\\\\w\\\\d./\\\\-\_#?&=%\]+";
/\*\*
\* Extension builder.
\* @param container The component's container (screen).
\*/
public TextExtractor(ComponentContainer container) {
super(container.$form());
Log.d(LOG_TAG, "TextExtractor Extension Initialized");
}
/\*\*
\* Generic function to extract the first occurrence that matches a given regex.
\* @param text The source text (can be plain text or HTML).
\* @param regexString The regular expression (Regex) to use for the search.
\* @return The first match found, or an empty string if nothing is found.
\*/
@SimpleFunction(description = "Extracts the first string matching the provided regular expression. " +
"Returns an empty string if no match is found.")
public String ExtractByRegex(String text, String regexString) {
if (text == null || regexString == null || text.isEmpty() || regexString.isEmpty()) {
return "";
}
try {
Pattern pattern = Pattern.compile(regexString);
Matcher matcher = pattern.matcher(text);
if (matcher.find()) {
// Returns the first string found
return matcher.group();
}
} catch (Exception e) {
Log.e(LOG_TAG, "Erreur In ExtractByRegex: " + e.getMessage());
// In case of error (ex: regex invalide), return empty
return "";
}
return "";
}
/\*\*
\* Extract the first email address found in the text.
\* @param text The source text.
\* @return The first email address, or an empty string.
\*/
@SimpleFunction(description = "Extract the first email address found in the text. " +
"Uses standard Regex for email.")
public String ExtractEmail(String text) {
return ExtractByRegex(text, EMAIL_REGEX);
}
/\*\*
\* Extracts the first number (integer or decimal) found in the text.
\* @param text The source text.
\* @return The first number found as a string, or an empty string.
\*/
@SimpleFunction(description = "Extracts the first number (integer or decimal) found in the text. " +
"Uses standard Regex for numbers.")
public String ExtractNumber(String text) {
return ExtractByRegex(text, NUMBER_REGEX);
}
/\*\*
\* Extracts the first hyperlink (URL starting with http or https) found.
\* @param text The source text (useful for parsing HTML).
\* @return The first hyperlink, or an empty string.
\*/
@SimpleFunction(description = "Extract the first hyperlink (URL starting with http or https) found in the text. " +
"Use Regex for URLs.")
public String ExtractHyperlink(String text) {
return ExtractByRegex(text, URL_REGEX);
}
/\*\*
\* Extract a specific word or phrase from text using a simple string search.
\* This function could be used by user for simple search without Regex.
\* @param text The source text.
\* @param sentence The sentence or word to search for.
\* @return The phrase/word if found, otherwise an empty string.
\*/
@SimpleFunction(description = "Extract a specific sentence or word from the source text. " +
"Returns the sentence if found, otherwise an empty string. " +
"This is case sensitive.")
public String ExtractSpecificPhrase(String text, String phrase) {
if (text == null || phrase == null || text.isEmpty() || phrase.isEmpty()) {
return "";
}
if (text.contains(phrase)) {
return phrase;
}
return "";
}
}